[R] Retrieving objects from functions...
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu Sep 30 10:10:59 CEST 2004
Jonathan Harris wrote:
> I've written a program that involves a loop that creates a matrix. I'd
> like to be able to manipulate that matrix on my R desktop, but after I
> run the function, that matrix does not appear when I type ls(). How can
> I make that matrix become an object that I can manipulate?
Return it from the function and assign it outside:
foo <- function(anything){
TheMatrix <- fun(anything)
return(TheMatrix)
}
result <- foo(something)
Now, you have the resulting matrix assigned to an object called "result".
Please read "An Introduction to R"!
Uwe Ligges
> Thanks!
>
> ______________________________________________
> 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
More information about the R-help
mailing list