[datatable-help] Access to local variables in "j" expressions
Short, Tom
TShort at epri.com
Sat May 8 20:17:13 CEST 2010
I checked in a fix for this bug on R-forge. It should be available for installation tomorrow as follows (R-forge has been a little flakey lately):
install.packages("data.table",repos="http://r-forge.r-project.org")
If you're able to try it, let me know if it works or causes other problems.
- Tom
> -----Original Message-----
> From: datatable-help-bounces at lists.r-forge.r-project.org
> [mailto:datatable-help-bounces at lists.r-forge.r-project.org]
> On Behalf Of Short, Tom
> Sent: Saturday, May 08, 2010 10:58 AM
> To: Johann Hibschman; datatable-help at lists.r-forge.r-project.org
> Subject: Re: [datatable-help] Access to local variables in
> "j" expressions
>
> I've got a fix for this. It'll probably be a couple of days
> before I can get it up to R-forge.
>
> - Tom
>
> > -----Original Message-----
> > From: datatable-help-bounces at lists.r-forge.r-project.org
> > [mailto:datatable-help-bounces at lists.r-forge.r-project.org]
> > On Behalf Of Short, Tom
> > Sent: Saturday, May 08, 2010 7:35 AM
> > To: Johann Hibschman; datatable-help at lists.r-forge.r-project.org
> > Subject: Re: [datatable-help] Access to local variables in "j"
> > expressions
> >
> > I think it's a bug, Johann. I'll dig deeper. Thanks for
> reporting it.
> >
> > - Tom
> >
> >
> > > -----Original Message-----
> > > From: datatable-help-bounces at lists.r-forge.r-project.org
> > > [mailto:datatable-help-bounces at lists.r-forge.r-project.org]
> > > On Behalf Of Johann Hibschman
> > > Sent: Friday, May 07, 2010 4:53 PM
> > > To: datatable-help at lists.r-forge.r-project.org
> > > Subject: [datatable-help] Access to local variables in "j"
> > expressions
> > >
> > > I'm just taking a look at data.table again, now that
> 1.4.1 has been
> > > released. I tried the following:
> > >
> > > dt.test <- data.table(n=c("a","a","b"), x=1:3, key="n")
> > >
> > > global.sum7 <- function (y) {
> > > sum(y) + 7
> > > }
> > >
> > > test.1 <- function (dt) {
> > > local.sum7 <- global.sum7
> > > dt[, list(out=local.sum7(x)), by=n]
> > > }
> > >
> > > test.1(dt.test)
> > >
> > > This failed, with 'Error in eval(expr, envir, enclos) :
> > > could not find function "local.sum7"'. Looking at the
> > documentation, I
> > > see:
> > >
> > > The j expression 'sees' variables in the calling frame
> > and above
> > > including .GlobalEnv, see the examples. This is base R
> > > functionality from eval() and with().
> > >
> > > That led me to think that the above would work. Is this a
> > bug, or am I
> > > not understanding something?
> > >
> > > Thanks,
> > > Johann
> > > _______________________________________________
> > > datatable-help mailing list
> > > datatable-help at lists.r-forge.r-project.org
> > > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/d
> > atatable-help
> > >
> > _______________________________________________
> > datatable-help mailing list
> > datatable-help at lists.r-forge.r-project.org
> > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/d
> atatable-help
> >
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/d
atatable-help
>
More information about the datatable-help
mailing list