[R] how to store recursive results

Gabor Grothendieck ggrothendieck at gmail.com
Fri Sep 22 12:49:22 CEST 2006


Note that <<- is not necessarily global:

if (exists("x")) rm(x)
f <- function() {
	x <- 2
	g <- function() x <<- 3
	g()
	x
}
f() # 3
exists("x") # FALSE

On 9/22/06, X.H Chen <xchen_stat at hotmail.com> wrote:
> Hi all,
>
> How to store recursive resutls from a function for each step without using
> global operators <<-? Thanks ahead.
>
> Xiaohui Chen
>
> Dept. of Statistics
> UBC, Canada
>
> _________________________________________________________________
> Don't waste time standing in line—try shopping online. Visit Sympatico / MSN
>
>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>



More information about the R-help mailing list