Rbind two vectors in R -
i have data.frame several columns i'd join 1 column in new data.frame.
df1 <- data.frame(col1 = 1:3, col2 = 4:6, col3 = 7:9)
how create new data.frame single column that's 1:9?
since data.frame
s lists of columns, unlist(df1)
give 1 large vector of values. can construct new data.frame
it:
data.frame(col = unlist(df1))
Comments
Post a Comment