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!

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to