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
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
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
>
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(
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
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),
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
7 matches
Mail list logo