Hello, I upgraded from 3.1.2 to 3.2.1 and am receiving errors on code that worked as I intended previously. Briefly, I am using bquote to generate expressions to modify data.table objects within a function, so I need the changes to actually be stored in the given environment. Previously, I used code like the following: test <- list(bquote(x <- 10)) fenv <- environment() rapply(test, evalq, envir = fenv) Although the code in the example above is much simpler, it shows the problem. On 3.1.2 the expression is evaluated and x is stored as 10 in the given environment, fenv. In 3.2.1 the code throws an error: Error in eval(substitute(expr), envir, enclos) : object 'X' not found I could not find anything in the release notes that would explain this change. Changing evalq to eval works in 3.2.1, but eval does not store x in the given environment in 3.1.2. Thanks, Dayne [[alternative HTML version deleted]]
On 15/07/2015 2:49 PM, Dayne Filer wrote:> Hello, > > I upgraded from 3.1.2 to 3.2.1 and am receiving errors on code that worked > as I intended previously. Briefly, I am using bquote to generate > expressions to modify data.table objects within a function, so I need the > changes to actually be stored in the given environment. Previously, I used > code like the following: > > test <- list(bquote(x <- 10)) > fenv <- environment() > rapply(test, evalq, envir = fenv) > > Although the code in the example above is much simpler, it shows the > problem. On 3.1.2 the expression is evaluated and x is stored as 10 in the > given environment, fenv. In 3.2.1 the code throws an error: > > Error in eval(substitute(expr), envir, enclos) : object 'X' not found > > I could not find anything in the release notes that would explain this > change. Changing evalq to eval works in 3.2.1, but eval does not store x in > the given environment in 3.1.2.Please submit this as a bug report (at bugs.r-project.org). I don't know for sure that it's a bug, but it looks like one: there's no 'X' in your code, so that message is coming from something internal. It would be helpful to include results that work from 3.1.2 as well as what you're seeing in 3.2.1. I'm still seeing the error you reported in R-devel, so I think the bug is still there... Duncan Murdoch
I am curious why you used evalq instead of eval in this code. Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Jul 15, 2015 at 11:49 AM, Dayne Filer <dayne.filer at gmail.com> wrote:> Hello, > > I upgraded from 3.1.2 to 3.2.1 and am receiving errors on code that worked > as I intended previously. Briefly, I am using bquote to generate > expressions to modify data.table objects within a function, so I need the > changes to actually be stored in the given environment. Previously, I used > code like the following: > > test <- list(bquote(x <- 10)) > fenv <- environment() > rapply(test, evalq, envir = fenv) > > Although the code in the example above is much simpler, it shows the > problem. On 3.1.2 the expression is evaluated and x is stored as 10 in the > given environment, fenv. In 3.2.1 the code throws an error: > > Error in eval(substitute(expr), envir, enclos) : object 'X' not found > > I could not find anything in the release notes that would explain this > change. Changing evalq to eval works in 3.2.1, but eval does not store x in > the given environment in 3.1.2. > > Thanks, > > Dayne > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >[[alternative HTML version deleted]]
In 3.1.2 eval does not store the result of the bquote-generated call in the given environment. Interestingly, in 3.2.1 eval does store the result of the bquote-generated call in the given environment. In other words if I run the given example with eval rather than evalq, on 3.1.2 "x" is never stored in "fenv," but it is when I run the same code on 3.2.1. However, the given example stores "x" in "fenv" on 3.1.2, but throws the error I gave when run on 3.2.1. To give credit, I received the idea for using evalq from SO: http://stackoverflow.com/a/22559385 Dayne On Wed, Jul 15, 2015 at 3:29 PM, William Dunlap <wdunlap at tibco.com> wrote:> I am curious why you used evalq instead of eval in this code. > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Wed, Jul 15, 2015 at 11:49 AM, Dayne Filer <dayne.filer at gmail.com> > wrote: > >> Hello, >> >> I upgraded from 3.1.2 to 3.2.1 and am receiving errors on code that worked >> as I intended previously. Briefly, I am using bquote to generate >> expressions to modify data.table objects within a function, so I need the >> changes to actually be stored in the given environment. Previously, I used >> code like the following: >> >> test <- list(bquote(x <- 10)) >> fenv <- environment() >> rapply(test, evalq, envir = fenv) >> >> Although the code in the example above is much simpler, it shows the >> problem. On 3.1.2 the expression is evaluated and x is stored as 10 in the >> given environment, fenv. In 3.2.1 the code throws an error: >> >> Error in eval(substitute(expr), envir, enclos) : object 'X' not found >> >> I could not find anything in the release notes that would explain this >> change. Changing evalq to eval works in 3.2.1, but eval does not store x >> in >> the given environment in 3.1.2. >> >> Thanks, >> >> Dayne >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > >[[alternative HTML version deleted]]