[datatable-help] Error when using eval() in j
Matthew Dowle
mdowle at mdowle.plus.com
Sun Aug 15 02:18:56 CEST 2010
Harish,
Thats a bug. I added #1026, fixed, +test 182, +NEWS and committed.
Thanks as always for reporting and for the nice reproducible example.
Matthew
On Sat, 2010-08-14 at 01:08 -0700, Harish wrote:
> I am running into an issue using a quote with eval in 'j'. I think I had a similar issue with 'by' in the past; maybe it is a similar bug.
>
> Use the following code to reproduce:
> ---------------------
>
> foo <- function( data, fcn ) {
> q <- substitute( fcn )
>
> # The following line works
> #data[ , eval( q ), by=a ]
>
> # The following line causes an error
> data[ , eval( substitute( fcn ) ), by=a ]
> }
>
> num <- 10
> DT <- data.table( a=rep(c("A","B"),num), b=1:(num*2) )
> foo( DT, sum(b) )
>
> ---------------------
>
> Notice the two lines inside foo(). They should be logically equivalent, but only one works.
>
> Is this a bug?
>
>
> Harish
>
>
>
>
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
More information about the datatable-help
mailing list