I have a data frame with 12 columns and Five Rows. I need to convert this into a column vector with each row being successively pasted one below other.
For example 1 2 3 A abc B def C ghi
I need the final output as A1 abcdefghi
我们可以转置数据集,将其连接到vector
并创建单个列data.frame
out <- data.frame(col1 = c(t(df1)))
If you want the rownames to be which column it comes from try,
data.frame(all = unlist(mtcars))
# all
# mpg1 21.000
# mpg2 21.000
# mpg3 22.800
# mpg4 21.400
# mpg5 18.700
# mpg6 18.100
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.