Displaying 1 result from an estimated 1 matches for "startgiven".
2009 Jul 17
2
Remembering a value in multiple calls of a function
...iment (see below). The "<<-"
operator assigns to in the calling environment which would be the
environment of "getN".
Yet when the function incr is returned, isn't this environment lost?
Also the print displays GlobalEnv, yet the globalenv does not have any
mention of startgiven.
This code was inspired from and old issue of RJournal , but I'm not
sure how this works.
I'm not sure how this works and an explanation would be helpful.
Thank you
Saptarshi
getN <- function(start){
startgiven <- start;
incr <- function(n=NA){
print(parent.frame())...