[R] unlist & dataframes
Naira
nanao at psb.ugent.be
Thu Nov 6 11:57:15 CET 2008
Dear all,
I would like to know whether it is possible to unlist elements and keep the
original format of the data.
To make it more clear, let me give an exemple:
I have a list l of dataframes that I created with apply but which looks like
this:
x1=data.frame(Name=LETTERS[1:2],Age=1:2)
x2=data.frame(Name=LETTERS[3:4],Age=3:4)
l=list(x1,x2)
l
[[1]]
Name Age
1 A 1
2 B 2
[[2]]
Name Age
1 C 3
2 D 4
I would like to unlist l to create a dataframe with 2 columns and 4 rows but
keeping the format of Name (character) and Age (numeric).
Now when I unlist l, I obtain :
unlist(l)
Name1 Name2 Age1 Age2 Name1 Name2 Age1 Age2
1 2 1 2 1 2 3 4
Is there a way to at least obtain something like
A 1 B 2 C 3 D 4 as result from the unlist??
Thanks a lot for your replies
Naira
--
View this message in context: http://www.nabble.com/unlist---dataframes-tp20358993p20358993.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list