Displaying 20 results from an estimated 50000 matches similar to: "The default argument 'envir' of eval()"
2007 Dec 22
2
Understanding eval
After many hours of debugging code, I came to the conclusion that I
have a fundamental misunderstanding regarding eval, and hope that
someone here can explain to me, why the following code acts as it does:
foo <- function(expr) {
eval(substitute(expr), envir=list(a=5), enclos=parent.frame())
}
bar <- function(er) {
foo(er)
}
> foo(a)
[1] 5
> bar(a)
Error in eval(expr,
2007 Jun 07
1
MITOOLS: Error in eval(expr, envir, enclos) : invalid 'envir' argument
R-users & helpers:
I am using Amelia, mitools and cmprsk to fit cumulative incidence curves
to multiply imputed datasets. The error message that I get
"Error in eval(expr, envir, enclos) : invalid 'envir' argument"
occurs when I try to fit models to the 50 imputed datasets using the
"with.imputationList" function of mitools. The problem seems to occur
2007 Nov 13
1
`eval' and environment question
my understanding of `eval' behaviour is obviously
incomplete.
my question: usually `eval(expr)' and `eval(expr,
envir=parent.frame())' should be identical. why does the
last `eval' (yielding `r3') in this code _not_ evaluate in
the local environment of function `f' but rather in the
global environment (if `f' is called from there)?
2010 Sep 21
3
Error in eval(expr, envir, enclos)
I am absolutely new to R and I am aware of only a few basic command lines. I
was running a robust regression in R, using the following command line
library (MASS)
rfdmodel1 <- rlm (TotalEmployment_2004 ~ MISSISSIPPI + LOUISIANA +
TotalEmployment_2000 + PCWhitePop_2004 + UnemploymentRate_2004 +
PCUrbanPop2000 + PCPeopleWithACollegeDegree_2000 +
PCPopulation.of.or.over.65.years.of.age_2004)
2011 Mar 23
2
) Error in eval(expr, envir, enclos) : object '' not found
> datafilename="E:/my documents/r/sex/bysex1.csv"
> data.sex=read.table(datafilename,header=T)
> data.sex
y.sex.age.region.c.n
1 1980,F,A,N,-18.15,13.61
2 1980,F,A,N,-18.61,13.04
3 1980,F,A,N,-18.81,12.32
4 1990,F,A,N,-21.12,11.7
5 1990,F,A,N,-20.77,11.58
6 1990,F,A,N,-21.6,13.34
7 1990,F,A,N,-21.78,12.6
> model.anova<-aov(c~age*sex,data=data.sex)
From THE R BOOK -> Warning: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
2010 Mar 30
3
From THE R BOOK -> Warning: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
Dear friends,
I am testing glm as at page 514/515 of THE R BOOK by M.Crawley, that is
on proportion data.
I use glm(y~x1+,family=binomial)
y is a proportion in (0,1), and x is a real number.
I get the error:
In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
But that is exactly what was suggested in the book, where there is no
mention of a similar warning. Where am I
2012 May 15
1
Error in eval(expr, envir, enclos) : object 'Rayos' not found???
Hi R-listers,
I am trying to make a trellis boxplot with the HSuccess (y-axis) in each
Rayos (beach sections) (x-axis), for each Aeventexhumed (A, B, C) - nesting
event. I am not able to do so and keep receiving:
Error in eval(expr, envir, enclos) : object 'Rayos' not found
Please advise,
Jean
require(plyr)
resp <- read.csv("ABC Arribada R File Dec 12 Jean
2015 Feb 09
1
WISH: eval() to preserve the "visibility" (now value is always visible)
Sorry to intervene.
Argument passed to 'eval' is evaluated first.
So,
eval(x <- 2)
is effectively like
{ x <- 2; eval(2) } ,
which is effectively
{ x <- 2; 2 } .
The result is visible.
eval(expression(x <- 2))
or
eval(quote(x <- 2))
or
evalq(x <- 2)
gives the same effect as
x <- 2 .
The result is invisible.
In function 'eval2',
res <-
2004 Nov 18
5
Lexical Scoping: eval(expr,envir=)
Hi R-listers,
I am trying to better undertand what we would call "functional paradigm"
use of S/R to better map my programming activities in other languages.
This little function is aimed to create an object (at the end end, it would
have it's own class):
--
myObject =function(){
list(
a=1,
foo=function(b)
{
cat("b:",b)
2005 Feb 17
1
Error in eval(expr, envir, enclos) : numeric envir arg not of length one
I am working with a largish dataset of 25k lines and I am now tying to
use predict.
pred = predict(cuDataGlmModel, length + meanPitch + minimumPitch +
maximumPitch + meanF1 + meanF2 + meanF3 + meanF4 + meanF5 +
ratioF1ToF2 + rationF3ToF1 + jitter + shimmer + percentUnvoicedFrames
+ numberOfVoiceBreaks + percentOfVoiceBreaks + meanIntensity +
minimumIntensity + maximumIntensity +
2001 Jul 19
1
bug in eval
Is this a bug ?
> foo <- function(a, ...)
+ {
+ tl <- substitute(list(a=a))
+
+ ## the foll two should give the same results
+ ## according to defaults for eval
+
+ print(eval(tl ))
+ print(eval(tl, parent.frame()))
+ }
>
>
> foo1 <- function(...)
+ {
+ foo(...)
+ }
>
> test <- function(a = 6)
+ {
+ foo1(a = a)
+ }
>
>
2009 Dec 06
2
Error in eval(expr, envir, enclos) : object 'N' not found
I'm running an LSODA to generate some graphs, but I need to stop at a certain
point and use those values to generate another LSODA output. This is
working fine, but when I try to run the second LSODA, I get the "Error in
eval(expr, envir, enclos) : object 'N' not found". Any ideas what can be
causing this? I have no object 'N' anywhere in the script. I made an
2010 Dec 08
1
Error in eval.with.vis(expr, envir, enclos) : subscript out of bounds
I have a for-loop in my code that calls another .R file:
source("estimation.R")
This file runs through without any problems, so the program completes the loop one time. However, when the loop starts a second time and it comes time to call the file "estimation.R" again, program stops and prints the following error message:
"Error in eval.with.vis(expr, envir, enclos) :
2010 Oct 16
1
Error in eval(expr, envir, enclos) : object 'x' not found
Dear all
I tried to use regression to predicted mu data, but it has error like this:
> IWJR.complete
x y
[1,] 33.17635 2.4705021
[2,] 81.61225 3.3815620
[3,] 65.47392 1.6518975
[4,] 57.97806 1.6110785
[5,] 76.05528 2.1601246
[6,] 41.36090 1.5498132
[7,] 68.77844 2.8078691
[8,] 55.57040 2.1183063
[9,] 41.29287 1.8015709
[10,] 65.43935 2.3483183
[11,] 22.44821
2005 Jul 04
2
Problems with eval() in connection with match.call()
Dear all, I have a problem when passing parms from one function to another when the argument list is just '...'. Consider this example:
foo<-function(){
xx <- 111222
bar(x=xx)
}
bar <- function(...){
cl <- match.call(expand.dots=TRUE)
print(cl)
x <- eval(cl$x)
print(x)
}
foo()
> bar(x = xx)
> Error in eval(expr, envir, enclos) : Object "xx" not
2012 Dec 10
3
Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
Hi there
I'm trying to fit a logistic regression model to data that looks very similar to the data in the sample below. I don't understand why I'm getting this error; none of the data are proportional and the weights are numeric values. Should I be concerned about the warning about non-integer successes in my binomial glm? If I should be, how do I go about addressing it?
I'm
2013 Jan 28
1
parse/eval and character encoded expressions: How to deal with non-encoding strings?
Hi,
I am intending to save a path-describing character object in a slot of a
class I'm working on. In order to have the option to use "system.file" etc
in such string-saved path definitions, I wrote this
ExpressionEvaluator <- function(x){
x <- tryCatch(
expr=base::parse(text=x),
error = function(e){return(as.expression(x))},
finally=TRUE)
return(x)
}
This
2013 Nov 03
1
on.exit() & sys.on.exit(): Calling them via eval() does not work as hoped
Why does the following eval() call on sys.on.exit() not return what I
expect/evaluate in the proper environment?
foo <- function() {
cat("foo()...\n");
on.exit( message("exiting") )
cat("sys.on.exit():\n")
res <- sys.on.exit()
print(res)
cat("eval(sys.on.exit()):\n")
expr <- quote(sys.on.exit())
print(expr)
res <- eval(expr)
2011 Mar 24
3
Extract the names of the arguments in an "expression"
Hi everybody:
I need to get the names of the arguments in an object of class "expression".
I've got the following expression:
> x <- expression(rho * cos(omega))
Is there any function or procedure that returns the names of the arguments
(in the example: "rho" and "omega")?
I tried a rough approach implemented in the function expr.args() shown
below. As
2006 Oct 27
1
Using data and subset arguments in user-defined functions
Dear list,
A while ago, I posted a question asking how to use data or subset
arguments in a user-defined function. Duncan Murdoch suggested the
following solution in the context of a data argument:
data <- data.frame(a=c(1:10),b=c(1:10))
eg.fn <- function(expr, data) {
x <- eval(substitute(expr), envir=data)
return(mean(x))
}
eg.fn(a,data)
I've