[R] Merge 10 data frames with 3 id columns that are common to all data frames

2009-03-08 Thread Pele
Hi R users, Can anyone share some example code using merge_all (from the reshape package) to merge 10 data frames into 1 file. Thanks in advance for any help! -- View this message in context:

Re: [R] Merge 10 data frames with 3 id columns that are common to all data frames

2009-03-08 Thread baptiste auguie
Hi, Try this: DF1 - data.frame(var1 = letters[1:5], x = rnorm(5), y =2) DF2 - data.frame(var1 = letters[3:7], x = rnorm(5), y=3) DF3 - data.frame(var1 = letters[6:10], x = rnorm(5), y=0) # ... DF10 if you wish ( result - merge_all(list(DF1, DF2, DF3) )) save( result, file =merged.rda) I

Re: [R] Merge 10 data frames with 3 id columns that are common to all data frames

2009-03-08 Thread Pele
I tried using merge_all as shown below but I am getting an error ... can anyone tell me what I am doing wrong? The result table below is what I am looking for. DF1 - data.frame(var1 = letters[1:5], x = rnorm(5), y =2) DF2 - data.frame(var1 = letters[1:5], t = rnorm(5), u =2) DF3 -

Re: [R] Merge 10 data frames with 3 id columns that are common to all data frames

2009-03-08 Thread baptiste auguie
The function expects a list of data.frames as a first argument but you provided a data.frame instead, the others are interpreted as optional arguments to merge_recurse(). Try this instead, merge_recurse(list(DF1,DF2,DF3,DF4)) var1x yt u d ef o 1a

Re: [R] Merge 10 data frames with 3 id columns that are common to all data frames

2009-03-08 Thread Pele
Perfect - many thanks!!! baptiste auguie-2 wrote: The function expects a list of data.frames as a first argument but you provided a data.frame instead, the others are interpreted as optional arguments to merge_recurse(). Try this instead, merge_recurse(list(DF1,DF2,DF3,DF4))