[R] Local Scopes in S

Jorge Luis Ojeda Cabrera jojeda at posta.unizar.es
Fri Oct 20 18:11:33 CEST 2000


I 've been working with R since last year and I am quite "happy" with R 
capabilities. Nevertheless, I need to present my job to other people 
(S-users) and I am facing a problem with R & S compatibility: my 
R-scripts make intensive use of functions local scope, and as far as I 
know(I am a new to S) S does not have this capability.

I use to  do things like:

create.f <- function(data)
{
	f <- function(x) { return( sum(data-x) );}
	return( f )
}

d <- 1:10
g <- create.f(d)
d <- NULL
g(1)
[1] 45

Does exist an easy way to solve the problem ?
May be I've missed some easier implementation in R..?

Thanks in advance.



########################################################################
Jorge Ojeda.

Profesor Asociado.
Dept. Métodos Estadísticos.
Universidad de Zaragoza.
########################################################################
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list