search for: r_sysfram

Displaying 3 results from an estimated 3 matches for "r_sysfram".

Did you mean: r_sysframe
2016 Mar 27
2
sys.function(0)
As I understand https://stat.ethz.ch/R-manual/R-devel/library/base/html/sys.parent.html sys.function(n) returns the function associated with stack frame n. Since frame 0 is defined as .GlobalEnv which is not associated with a function, I would expect this to always return NULL. However, it does not: > sys.function() NULL > f <- function(x) sys.function(x) > f(0) function(x)
2016 Mar 27
0
sys.function(0)
...g. The case "which = 0" differs between sys.frame() and sys.call()/sys.function(). For the latter, it means the current call/function, whereas sys.frame(0) is always the global envir. It is pretty clear from the underlying C code that the three functions treat their argument differently: R_sysframe has if (n == 0) return(R_GlobalEnv); if (n > 0) n = framedepth(cptr) - n; else n = -n; whereas the other two (R_syscall and R_sysfunction) omit the special treatment for n==0. Without this, n==0, comes out unchanged from the if-construct, indicating that o...
2016 Mar 27
1
sys.function(0)
...se "which = 0" differs between sys.frame() and sys.call()/sys.function(). For the latter, it means the current call/function, whereas sys.frame(0) is always the global envir. It is pretty clear from the underlying C code that the three functions treat their argument differently: > > R_sysframe has > > if (n == 0) > return(R_GlobalEnv); > > if (n > 0) > n = framedepth(cptr) - n; > else > n = -n; > > whereas the other two (R_syscall and R_sysfunction) omit the special treatment for n==0. Without this, n==0, comes o...