Skip to content
Prev 347803 / 398500 Next

collapse a list of dataframes

I don't think that worked as OP would like it too - all columns of the
output
are factors.
data.frame(rbind(as.matrix(data.frame(a=1:3,b=letters[1:3])),as.matrix(data.frame(x=1:5,b=LETTERS[1:5]))))
  a b
1 1 a
2 2 b
3 3 c
4 1 A
5 2 B
6 3 C
7 4 D
8 5 E
'data.frame':   8 obs. of  2 variables:
 $ a: Factor w/ 5 levels "1","2","3","4",..: 1 2 3 1 2 3 4 5
 $ b: Factor w/ 8 levels "a","A","b","B",..: 1 3 5 2 4 6 7 8

If you want the retain the types of the columns, leave out those as.matrix()
calls (and then there is no need to call data.frame on rbind's output).



Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Feb 3, 2015 at 12:56 PM, JS Huang <js.huang at protective.com> wrote: