[R] Join data frame columns

Ivan Calandra ivan.calandra at u-bourgogne.fr
Tue Oct 23 14:56:34 CEST 2012


Hi!

Either I don't understand what you want to do, or it doesn't make any sense.

First, a vector cannot have different modes. If you want a single vector 
it will most likely be coerced in to characters; probably not what you want.

Second, what you do is build a data.frame with another data.frame 
without doing anything. What is df? Provide the output of dput(df).
How do you want new_df to look like? What is the difference with df?

Ivan

--
Ivan CALANDRA
Université de Bourgogne
UMR CNRS/uB 6282 Biogéosciences
6 Boulevard Gabriel
21000 Dijon, FRANCE
+33(0)3.80.39.63.06
ivan.calandra at u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra

Le 23/10/12 13:45, brunosm a écrit :
> Hi,
>
> I have a data frame with 100 variables (numeric and non numeric types), and
> I want to join them in only one column, like a vector, but i want to keep
> the non numeric variables like they are.
>
> I know that i can do something like this:
>
> Suppose that my data is in df variable
>
> new_df<-data.frame(c(df[,1],df[,2],df[,3],df[,4],...........)
>
> This works but i have 100 variables!
>
> Any way of doing this a little bit faster?
>
> Thanks a lot!
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Join-data-frame-columns-tp4647113.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list