Hi,

On Tue, Apr 12, 2011 at 3:35 PM, Johann Hibschman
<[email protected]> wrote:
> I finally managed to upgrade to 1.5.3, but now I'm seeing errors when
> aggregating data tables:
>
>  > d <- data.table(a=as.integer(c(1, 1, 2, 2, 3, 3)), b=1:6 %% 2, c=1:6)
>  > d[b==1,list(c=sum(c)),by=list(a)]
>  Error in i[1, ivars, with = FALSE] : incorrect number of dimensions
>
> Does anyone know what's going on with this?

Not off the top of my head (although I'm sure Matthew will figure it
out quite quickly).

In the meantime, you could do this like so:

R> d[b==1][, list(c=sum(c)), by=list(a)]

If your `d` data.table is large, though, you might consider:

R> key(d) <- c('b', 'a')
R> d[J(1)][, list(c=sum(c)), by=list(a)]

Also, I'm using the development version of data.table from R-forge,
but I don't think that'll make a difference in this case.

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to