Hi again,
It seems that you want the modes to be conserved. This is just not
possible; everything will be coerced to characters, as Rui highlighted.
But the question is why do you want to do this? You would loose helpful
information (i.e. modes). Maybe there is a better way to do what you
want to do.
HTH,
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.calan...@u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra
Le 23/10/12 16:15, Rui Barradas a écrit :
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@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.
______________________________________________
R-help@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.
______________________________________________
R-help@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.