Re: [R] Merging a dataframe after subsetting with respect to several factors

2019-06-13 Thread Jeff Newmiller
Sorry... I missed that the mailing list had been removed from this email. Tina... always keep the mailing list included when you ask questions. On Thu, 13 Jun 2019, Jeff Newmiller wrote: I am sorry I did not read more closely earlier... I agree with Bert... you do need to spend some time learn

Re: [R] Merging a dataframe after subsetting with respect to several factors

2019-06-13 Thread Bert Gunter
Jeff: Your solution is not quite what she asked for (she wanted a data frame, not a list). Moreover, most of the time it is done automatically as the first step of a tapply() /filter() type operation or is inherent in modeling and trellis-type plots. I *still* suspect it is unnecessary, but of cou

Re: [R] Merging a dataframe after subsetting with respect to several factors

2019-06-13 Thread Jeff Newmiller
I do it regularly. Base R: result <- split( DF[ , 4, drop=FALSE ], DF[ , -4 ] ) Tidyverse: library(tidyr) result <- nest( DF, time ) filter( result, "a2"==a & "b1"==b & "c1"==c )[[ "data" ]] On Thu, 13 Jun 2019, Bert Gunter wrote: Why? I suspect that there is no reason that you need to do t

Re: [R] Merging a dataframe after subsetting with respect to several factors

2019-06-13 Thread Bert Gunter
Why? I suspect that there is no reason that you need to do this. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Jun 13, 2019 at 1:22 PM Tina

Re: [R] Merging a dataframe after subsetting with respect to several factors

2019-06-13 Thread Richard O'Keefe
How about just df$time[match(paste(df$a, df$b, df$c), c( "co mb o1", .. "co mb oN"))] On Fri, 14 Jun 2019 at 08:22, Tina Chatterjee wrote: > Hello everyone! > I have the following dataframe(df). > > a<-c("a1","a2","a2","a1","a1","a1") > b<-c("b1","b1","b1","b1","b1","b2") > c<-c(

[R] Merging a dataframe after subsetting with respect to several factors

2019-06-13 Thread Tina Chatterjee
Hello everyone! I have the following dataframe(df). a<-c("a1","a2","a2","a1","a1","a1") b<-c("b1","b1","b1","b1","b1","b2") c<-c("c1","c1","c1","c1","c1","c2") time <- c(runif(6,0,1)) df<-data.frame(a,b,c,time) df a b c time 1 a1 b1 c1 0.28781082 2 a2 b1 c1 0.02102591 3 a2 b1 c1 0.724