Displaying 20 results from an estimated 10000 matches similar to: "Question about "evalq""
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
On Jul 15, 2015, at 12:51 PM, William Dunlap wrote:
> I think rapply() was changed to act like lapply() in this respect.
>
When I looked at the source of the difference, it was that typeof() returned 'language' in 3.2.1, while it returned 'list' in the earlier version of R. The first check in rapply's code in both version was:
if (typeof(object) != "list")
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
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
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
David,
If you are referring to the solution that would be:
rapply(list(test), eval, envir = fenv)
I thought I explained in the question that the above code does not work. It
does not throw an error, but the behavior is no different (at least in the
output or result). Using the above code still results in the x object not
being stored in fenv on 3.1.2.
Dayne
On Wed, Jul 15, 2015 at 4:40 PM,
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
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,
2002 Sep 04
3
strange things with eval and parent frames
Dear mailing list,
I have found some strange behaviour which I think relates to parent frames
and eval. Can anyone explain what's going on here?
First example:
> test.parent.funcs_ function() {
outer.var_ 5
subfunc1_ function() substitute( outer.var, envir=parent.frame())
print( subfunc1())
subfunc2b_ function() eval( quote( outer.var), envir=parent.frame())
print(
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
I think rapply() was changed to act like lapply() in this respect.
In R-3.1.3 we got
rapply(list(quote(1+myNumber)), evalq, envir=list2env(list(myNumber=17)))
#[1] 18
rapply(list(quote(1+myNumber)), eval, envir=list2env(list(myNumber=17)))
#Error in (function (expr, envir = parent.frame(), enclos = if
(is.list(envir) || :
object 'myNumber' not found
lapply(list(quote(1+myNumber)),
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
Another aspect of the change is (using TERR's RinR package):
> options(REvaluators=list(makeREvaluator("R-3.1.3"),
makeREvaluator("R-3.2.0")))
> RCompare(rapply(list(quote(function(x)x),list(quote(pi),quote(7-4))),
function(arg)typeof(arg)))
R version 3.1.3 (2015-03-09) R version 3.2.0 (2015-04-16)
[1,] [1]
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
Bill,
Is your conclusion to just update the code and enforce using the most
recent version of R?
Dayne
On Wed, Jul 15, 2015 at 4:44 PM, Dayne Filer <dayne.filer at gmail.com> wrote:
> David,
>
> If you are referring to the solution that would be:
>
> rapply(list(test), eval, envir = fenv)
>
> I thought I explained in the question that the above code does not work.
2007 May 18
1
subset arg in (modified) evalq
Hi,
When using evalq to evaluate expressions within a say data.frame context I often wish there was a 'subset' argument, much like in lm() or any ather advanced regression model. I would be grateful for a tip how to do this.
Here is an illustration of what I want:
n <- 100
data <- data.frame(x=rnorm(n), y=rnorm(y), z=rnorm(z))
# this works
evalq({ i <- 0<x;
2007 Jun 08
1
evaluating variables in the context of a data frame
Given
> D = data.frame(o=gl(2,1,4))
this works as I expected:
> evalq(o, D)
[1] 1 2 1 2
Levels: 1 2
but neither of these does:
> f <- function(x, dat) evalq(x, dat)
> f(o, D)
Error in eval(expr, envir, enclos) : object "o" not found
> g <- function(x, dat) eval(x, dat)
> g(o, D)
Error in eval(x, dat) : object "o" not found
What am I doing wrong?
2007 Feb 14
1
predict.lm point forecasts with factors
hello,
I am trying to use predict.lm to make point forecasts based on a model with
continuous and categorical independent variables
I have no problems fitting the model using lm, but when I try to use predict
to make point predictions. it reverts back to the original dataframe and
gives me the point predictions for the fitted data rather than for the new
data, I imagine that I am missing
2012 Mar 15
1
eigenvalues of matrices of partial derivatives with ryacas
Hello,
I am trying to construct two matrices, F and V, composed of partial
derivatives and then find the eigenvalues of F*Inverse(V). I have the
following equations in ryacas notation:
> library(Ryacas)
> FIh <- Expr("betah*Sh*Iv")
> FIv <- Expr("betav*Sv*Ih")
> VIh <- Expr("(muh + gamma)*Ih")
> VIv <- Expr("muv*Iv")
I
1999 Dec 11
1
Problems with recursive MPUT
I'm running samba 2.0.5a on a Sun Sparc 5 with Solaris 2.6 and trying to
use smbclient to copy an entire directory tree to a Windows NT 4.0 box.
I'm using the recurse command and can create first level directories but
I am unable to create new subdirectories in any of them.
For example I created the following directory structure on the Sun:
1 % ls -R
.:
d1/ d2/
./d1:
f11 f12
2012 Sep 06
2
choose() function returning anomalous results (zero instead of one)
Hello,
(Apologies for length, wanted to get all the relevant detail in that I know
of).
I've been having a lot of trouble with some code for an inventory analysis
problem I was doing, and finally came to the conclusion that it appears
that choose() is returning incorrect values. Specifically:
-------------
Browse[1]> nn
[1] 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3
2015 Jul 15
0
bquote/evalq behavior changed in R-3.2.1
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
2011 Jan 04
5
scoping/non-standard evaluation issue
Dear r-devel list members,
On a couple of occasions I've encountered the issue illustrated by the
following examples:
--------- snip -----------
> mod.1 <- lm(Employed ~ GNP.deflator + GNP + Unemployed +
+ Armed.Forces + Population + Year, data=longley)
> mod.2 <- update(mod.1, . ~ . - Year + Year)
> all.equal(mod.1, mod.2)
[1] TRUE
>
> f <-
2015 Jan 14
2
Is the tcltk failure in affylmGUI related to R bug 15957
I maintain the package affylmGUI. It works when installed on many
previous versions of R. I have today tested exactly the same code under
R-2.15.3, R-3.0.2, R-3.1.0, R-3.1.1, R-3.1.2 and R-devel.
I have also tested the versions of affylmGUI downloaded by biocLite for
each version of R and the same result applies.
I have no errors under 2.15.3, 3.0.2, 3.1.0 and 3.1.1. The following
error
2011 Feb 03
2
"Matrix' with Functions
Dear R members,
I have a quite large of function that are named like that
f11,f12,...f15
f21,f22,...f25
..
f51,f52,...f52
These are static (hard-coded) functions that the only common they have is that they take the same number and type of input fij(a,b,c,d). As you might understand this is really close to the notion of matrix only that my 'matrix' contains functions. It would be great if
2004 May 20
4
pmvt problem in multcomp
Hi, all:
Two examples are shown below.
I want to use the multiple comparison of Dunnett.
It succeeded in upper case "example 1".
However, the lower case "example 2" went wrong.
In "example 2", the function pmvt return NaN, so I cannot show
this simtest result. Is there any solution?
(I changed the variable "maxpts" to a large number in front of
the
2011 Apr 09
2
best practice(s) for retrieving a local variable from a closure
Greetings,
Say I have defined
mp <- function(a) function(x) x^a
f2 <- mp(2)
and I would like to retrieve the "a" which is local to f2. Two options
come to mind;
get("a", envir=environment(f2))
eval(substitute(a), environment(f2))
I'm curious if one of these is preferred over the other in terms of
efficiency, robustness, aesthetics, etc. Or perhaps