简体   繁体   中英

How can I create a one-column dataframe containing all numeric values of a dataframe with several columns?

Sorry for the basic question here!

I am working the following type of dataset:

data <- data.frame(a=c(1,2,3), b=c(2,3,4), c=(10,11,12))

I am trying to turn it into a new data frame where there is only one column, containing all of these values in individual rows, ie a=c(1,2,3,2,3,4,10,11,12)

What function should I use to arrive at this output?

All the best,

Cameron

You can do data.frame(a = unlist(data)) .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM