Re: [R] Repeated Aggregation with data.table

2012-09-21 Thread Elliot Joel Bernstein
ion between those functions and the data.table >> call. (Running that code produces an error on my machine.) If the goal is >> to have an expression result then just create it with expression(). In the >> example: >> >> > flist <- expression( list(mean.z = me

Re: [R] Repeated Aggregation with data.table

2012-09-11 Thread Elliot Joel Bernstein
ssion( list(mean.z = mean(z), sd.z = sd(z)) ) > > dat[ , eval(flist), list(x)] >x mean.z sd.z > 1: 2 0.04436034 1.039615 > 2: 3 -0.06354504 1.077686 > 3: 1 -0.08879671 1.066916 > > -- > David. > > > A.K. >> >> >> >> - Original Mes

Re: [R] Repeated Aggregation with data.table

2012-08-08 Thread arun
ugust 8, 2012 9:17 AM Subject: Re: [R] Repeated Aggregation with data.table On Aug 7, 2012, at 9:28 PM, arun wrote: > HI, > > Try this: > > fun1<-function(x,.expr){ >  .expr<-expression(list(mean.z=mean(z),sd.z=sd(z))) >  z1<-eval(.expr) >  } > > #or >

Re: [R] Repeated Aggregation with data.table

2012-08-08 Thread David Winsemius
ct.org Cc: Sent: Tuesday, August 7, 2012 5:36 PM Subject: [R] Repeated Aggregation with data.table I have been using ddply to do aggregation, and I frequently define a single aggregation function that I use to aggregate over different groups. For example, require(plyr) dat <- data.frame(

Re: [R] Repeated Aggregation with data.table

2012-08-07 Thread arun
1),list(x,y)] A.K. - Original Message - From: Elliot Joel Bernstein To: r-help@r-project.org Cc: Sent: Tuesday, August 7, 2012 5:36 PM Subject: [R] Repeated Aggregation with data.table I have been using ddply to do aggregation, and I frequently define a single aggregation function that I use

Re: [R] Repeated Aggregation with data.table

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 4:36 PM, Elliot Joel Bernstein wrote: > I have been using ddply to do aggregation, and I frequently define a > single aggregation function that I use to aggregate over different > groups. For example, > > require(plyr) > > dat <- data.frame(x = sample(3, 100, replace=TRUE),

[R] Repeated Aggregation with data.table

2012-08-07 Thread Elliot Joel Bernstein
I have been using ddply to do aggregation, and I frequently define a single aggregation function that I use to aggregate over different groups. For example, require(plyr) dat <- data.frame(x = sample(3, 100, replace=TRUE), y = sample(3, 100, replace = TRUE), z = rnorm(100)) f <- function(x) { da