Re: [R] combine the data frames into comma separated list.

2011-06-13 Thread Mary Kindall
Superb Gabor, Though I dont know what is happening, but yes it is workin and without fail. Thanks - M On Mon, Jun 13, 2011 at 8:20 PM, Gabor Grothendieck wrote: > On Mon, Jun 13, 2011 at 5:17 PM, Mary Kindall > wrote: > > Hi R users, > > I am new to R and am trying to merge data frames in the

Re: [R] combine the data frames into comma separated list.

2011-06-13 Thread Dr. D. P. Kreil (Boku)
now that's beautiful! :-) Many thanks, David. > Try this where DF1, DF2 and DF3 are the data frames: > > L <- list(DF1, DF2, DF3) > merge.all <- function(...) merge(..., all = TRUE) > Reduce(merge.all, lapply(L, function(x) aggregate(x[2], x[1], toString))) > > The last line gives this: > >  Src

Re: [R] combine the data frames into comma separated list.

2011-06-13 Thread Gabor Grothendieck
On Mon, Jun 13, 2011 at 5:17 PM, Mary Kindall wrote: > Hi R users, > I am new to R and am trying to merge data frames in the following way. > Suppose I have n data frames each with two fields. Field 1 is common among > data frames but may have different entries. Field 2 is different. > > > Data fr

Re: [R] combine the data frames into comma separated list.

2011-06-13 Thread Dr. D. P. Kreil (Boku)
Ah, yes, the need to "condense" escaped me. I thought you wanted to write out the final result separated by commas. You will need to do the "condensing" separately. Unless someone else has a more elegant idea, I guess something along the lines of df2srcs<-unique(dataframe2$Src); df2new<-data.fram

Re: [R] combine the data frames into comma separated list.

2011-06-13 Thread Mary Kindall
How?? I dont think there is any parameter that does this job. I came up with ddply function in plyr package but having tens of dataframe and doing it in a for loop may not be a good idea. ddply(test, ~ Src , colwise(paste, .(Target1)), collapse ="," ); Can you please write how it can be done by

Re: [R] combine the data frames into comma separated list.

2011-06-13 Thread Dr. D. P. Kreil (Boku)
?write.csv Cheers, David. On 14 June 2011 01:07, Mary Kindall wrote: > Thanks for reply. > The following code is working but only patially. How to get the condensed > values separated by comma. > > dataframe1 = data.frame(cbind(Src = c(1,1,1,2,3), Target1 = > c('aaa','bbb','ccc','aaa','ddd')));

Re: [R] combine the data frames into comma separated list.

2011-06-13 Thread Mary Kindall
Thanks for reply. The following code is working but only patially. How to get the condensed values separated by comma. dataframe1 = data.frame(cbind(Src = c(1,1,1,2,3), Target1 = c('aaa','bbb','ccc','aaa','ddd'))); dataframe2 = data.frame(cbind(Src = c(2,3,4,4,4), Target2 = c('','','',

Re: [R] combine the data frames into comma separated list.

2011-06-13 Thread Dr. D. P. Kreil (Boku)
Hi, try ?merge Best, David. On 13 June 2011 23:48, Mary Kindall wrote: > Hi R users, > I am new to R and am trying to merge data frames in the following way. > Suppose I have n data frames each with two fields. Field 1 is common among > data frames but may have different entries. Field 2 is di

[R] combine the data frames into comma separated list.

2011-06-13 Thread Mary Kindall
Hi R users, I am new to R and am trying to merge data frames in the following way. Suppose I have n data frames each with two fields. Field 1 is common among data frames but may have different entries. Field 2 is different. Data frame 1: Src Target1 1aaa 1bbb 1ccc 2

[R] combine the data frames into comma separated list.

2011-06-13 Thread Mary Kindall
Hi R users, I am new to R and am trying to merge data frames in the following way. Suppose I have n data frames each with two fields. Field 1 is common among data frames but may have different entries. Field 2 is different. Data frame 1: Src Target1 1aaa 1bbb 1ccc 2