[R] Equivalent of S> assign( , ,frame=1)
Olivier Renaud
renaud at stat.stanford.edu
Thu Apr 27 18:47:52 CEST 2000
Hi,
I'm new to R, and I certainly miss an obvious point. I looked in the doc
and the archieve, but could not find what is the R equivalent of the S
assign( , ,frame=1). I guess the question is like what is the equivalent
of the S frames and how to access them. As an example:
oneprog <- function()
{
initial()
res <- subrout()
return(res)
}
initial <- function()
{
assign ("x", 2, frame=1)
assign ("y", 3, frame=1)
}
subrout <- function()
return(x+y)
This works perfectly with S. I know that if I put subrout inside oneprog
and replace the call to initial by a simple x <- 2;y <-3, it will work
on R (and not on S). But initial is a routine I use in many different
programs, and therefore I don't want it inside a given one. Any help?
More general comments on this way of programming are also welcomed.
Olivier
--
Olivier Renaud
Department of Statistics - Sequoia Hall - 390 Serra Mall
STANFORD, CA, 94305-4065 mailto:renaud at stat.stanford.edu
http://www.stanford.edu/~renaud
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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