R-beta: return()
Bill Simpson
wsimpson at uwinnipeg.ca
Thu Sep 25 19:07:31 CEST 1997
I have a question on the use of return(). (Nothing on it in the docs I
have)
The test code below gives the error: Error: Object "x" not found
when I do: thingy2().
How should it be fixed? Thanks very much for any help!
(My original solution to this sort of problem was to use global variables
x<<-...
y<<-...)
Bill Simpson
-----------------------------
thingy<-function(k)
{
x<-5+k
y<-5-k
return(list(x=x,y=y))
}
thingy2<-function()
{
thingy(10)
cat("x,y:",x,y,"\n")
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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