[R] writing functions
Jens Nieschulze
jniesch at gwdg.de
Sun May 5 20:47:03 CEST 2002
On Sun, 5 May 2002, graham lawrence wrote:
%This is my first attempt at writing a function. Would someone kindly
%explain its result, or non-result. Thanking you in advance.
%
the function uses a Call by value, ie n within your function is not
n outside your function
%restore<-function(){n<-Nx}
%>restore
%function(){n<-Nx}
%>n
%[1] 408
%>Nx
%[1] 10
%>restore()
%>n
%[1] 408
%
%and, by way of variation
%
%>restora<-function(n){n<-Nx}
%>n
%[1] 408
%>restora
%function(n){n<-Nx}
%>restora()
%>n
%[1] 408
%>restora(n)
%>n
%[1] 408
%
%graham lawrence
%
%_________________________________________________________________
%
%
%-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
%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
%_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
%
***********************************************************************
Jens Nieschulze
Institute for Forest Biometrics &
Applied Computer Science
Buesgenweg 4
37077 Goettingen
GERMANY
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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