[R] get: problem with environments

Martin Ivanov tramni at abv.bg
Sun Oct 7 18:10:51 CEST 2012


 Thank You very much for Your replies.
Dear Michael,

"Does this persist after a new session (perhaps running as R --vanilla) and/or reinstall?"
Yes, it does. After running R --vanilla, still there are 4 contexts more on the call stack.
 
"You didn't show us how you tried to use parent.frame()"
I did it like this:
testfun1 <- function (x1) {
 a1 <- 1;
 sapply(X="a1", FUN=get, envir=parent.frame(x1));
}

testfun1(x1=1);

The above code never succeeds no matter what a number I give to x1.

" 3. Why does the number of contexts in the call stack differ in R and in rkward?
 It shouldn't. This is an issue that needs further sorting out."

Here is some more info on my setup:
sessionInfo()       
R version 2.15.1 (2012-06-22)
Platform: x86_64-slackware-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US       LC_NUMERIC=C         LC_TIME=en_US       
 [4] LC_COLLATE=C         LC_MONETARY=en_US    LC_MESSAGES=en_US   
 [7] LC_PAPER=C           LC_NAME=C            LC_ADDRESS=C        
[10] LC_TELEPHONE=C       LC_MEASUREMENT=en_US LC_IDENTIFICATION=C 

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_2.15.1


Best regards,

Martin




More information about the R-help mailing list