[R] Join data frame columns
Rui Barradas
ruipbarradas at sapo.pt
Tue Oct 23 16:15:58 CEST 2012
Hello,
Sorry for my earlier post, I misunderstood what you want.
dat <- data.frame(letters, 1:26)
as.vector(sapply(d, as.character))
Hope this helps,
Rui Barradas
Em 23-10-2012 14:13, brunosm escreveu:
> Hi Ivan, thanks for your help!
>
> For example:
>
>> df
> num letters
> 1 1 A
> 2 2 B
> 3 3 C
> 4 4 D
> 5 5 E
>
> What i want is to join "num" and "letters" in a single column. Something
> like this
>
>> new_df
> 1 1
> 2 2
> 3 3
> 4 4
> 5 5
> 6 A
> 7 B
> 8 C
> 9 D
> 10 E
>
> I tried to do it with a list but it converts factors to numbers...
>
>> new_df<-list(c(df[,1],df[,2]))
>> new_df
> [[1]]
> [1] 1 2 3 4 5 1 2 3 4 5
>
> Thanks!
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Join-data-frame-columns-tp4647113p4647132.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