Arturo Rosete Arturo Rosete - 1 year ago 66
R Question

How can I mix different columns in only one column using r code?

I'm work in some statistical analysis for a school project.
I have a data frame with too many data about the air temperature of a buoy in somewhere near Brownsville. I have something like this:

Year91 Year92 and so forth... i have about 40 years
a 25.3 e 12.3
b 15.3 f 56.3
c 25.8 g 14.5
d 15.2 h 28.0

I read some articles, and writers say that i can use the cbind or rbind functions, but they doesn't work as the way i need.

I need mix the column because they have the same type of data, and I need a boxplot of every ten years. I want to do this:

a 25.3
b 15.3
c 25.8
d 15.2
e 12.3
f 56.3
g 14.5
h 28.0

I hope you can understand my question. Thanks!

Answer Source

We just do unlist(data) and create a data.frame based on that

res <- data.frame(Year91to01 = unlist(data, 
            use.names=FALSE), stringsAsFactors=FALSE)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download