As expected, this code
myLines="
Greek
alpha
beta
gamma
"
myData <- read.table(text=myLines, header=TRUE)
print(myData)
produces:
Greek
1 alpha
2 beta
3 gamma
I now want to mutate the vector c(1,2,3,4) to the end of each row in order to get this:
Greek justSomeVector
1 alpha c(1,2,3,4)
2 beta c(1,2,3,4)
3 gamma c(1,2,3,4)
So I tried this:
library(dplyr)
myData=myData%>%mutate(justSomeVector=c(1,2,3,4))
And this yields this error:
Error in mutate_impl(.data, dots) :
Column `justSomeVector` must be length 3 (the number of rows) or one, not 4
How do I have to change my code in order to make the mutation work?