I'm new in R and I have a problem. I created an "empty" data.frame, as in R I cannot do this, I created a vector to fulfil it that I would delete when finishing the script.
x <- c("aa", 0, 0, 0, "zz") #Vector to fulfill the dataframe (it will be deleted at the end of the script)
df <<- rbind(x) #Creating a matrix. See: class(df)
df <<- data.frame(df) #Converting the matrix into a data.frame
But now I need to fulfil that dataframe with three vectors:
a <- c("bb")
b <- c(2, 3, 4)
c <- c("yy")
The desired output is a dataframe like this:
X1 X2 X3 X4 X5
r1 aa 0 0 0 zz
r2 bb 2 3 4 yy
I have tried this: df <- rbind(df, a, b, c)
but it does not work...
Any suggestion?