[R] URGENT Help required

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Nov 26 13:54:08 CET 2002

arnaud_amsellem at ssga.com wrote:
> I've the following problem:
> The below function runs a loop with regression analysis and stores F-Stat
> in a matrix. When I call the matrix elements (models[i,j]) in the function
> I get proper results, but when I try to call  the same elements outside the
> function the matrix appears to be empty e.g when I call compt inside the
> function I get: 5 but when I call it outside I get: 1. This is the same
> problem with models which appears to be empty outside the function.
> Specifically I would like being able to  run the same function for various
> data frames and store the results in the same matrix (models) one after the
> other.

[code snipped]

Well, beside this remark on the completely nonsensical subject of this
message, I'd suggest to read the manual "An Introduction to R" or other
introductory literature.
Please try to understand the scoping rules. You need to return() values
from the function, in any other case the environment the function is
executed in will be deleted after execution (this summary is too short,
but I don't want to rewrite existing literature).

Uwe Ligges
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