Re: [R] problem about set operation and computation after split

2012-06-13 Thread Rui Barradas
Hello, It seems you haven't discovered the *apply functions yet. In this case, since you have a list, the function would be lapply. 1. Reduce(intersect, lapply(mySplit, function(x) x$product)) 2. lapply(mySplit, function(x) within(x, relative <- diff(c(value[1], value 3. lapply(mySplit,

Re: [R] problem about set operation and computation after split

2012-06-12 Thread R. Michael Weylandt
On Wed, Jun 6, 2012 at 2:43 AM, bestbird wrote: > hi, >    I met some problems in R, plz help me. > 1. How to do a intersect operation among several groups in one list, without > a loop statement? (I think It may be a list) >   create data: >   myData <- data.frame(product = c(1,2,3,1,2,3,1,2,2),

Re: [R] problem about set operation and computation after split

2012-06-12 Thread bestbird
can anyone help me? -- View this message in context: http://r.789695.n4.nabble.com/problem-about-set-operation-and-computation-after-split-tp4632496p4633192.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing l

[R] problem about set operation and computation after split

2012-06-06 Thread bestbird
hi, I met some problems in R, plz help me. 1. How to do a intersect operation among several groups in one list, without a loop statement? (I think It may be a list) create data: myData <- data.frame(product = c(1,2,3,1,2,3,1,2,2), year=c(2009,2009,2009,2010,2010,2010,2011,2011,2011),value