[Rd] sys.call and friends

Jeffrey Horner jeff.horner at vanderbilt.edu
Tue Apr 17 23:40:10 CEST 2007


Hello,


I noticed that sys.frame treats which = 0 differently than sys.call and 
sys.function, and the documentation was unclear about it.

 > f <- function() sys.call()
 > f()
f()
 > f <- function() sys.function()
 > f()
function() sys.function()
 > f <- function() sys.frame()
 > f()
<environment: R_GlobalEnv>

sys.frame(0) always returns the .GlobalEnv, while sys.call(0) and 
sys.function(0) return the current call and function definition.

I offer a patch to clarify this for the uninitiated.

 > sessionInfo()
R version 2.6.0 Under development (unstable) (2007-04-16 r41194)
i686-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

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

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sys.parent.rd.patch
Type: text/x-diff
Size: 2406 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20070417/248b1396/attachment.bin 


More information about the R-devel mailing list