very simple question.  I probably forgot the answer (early stage onset),
and I could not find it via google and r-help.

I have a number of files, each containing one saved data frame.  I want to
do the equivalent of

   d <- .GlobalEnv[[ load(file="dxxxx.Rdata") ]

but inside a function, and I don't need the original name (dxxxx).  in the
end, I want to do something like

   run <- function( i ) {
        fname <- paste0( "d", i, ".Rdata")
        stopifnot( length(fname)==1 )
        d <- .ThisEnv[[ load(file=fname) ]]
        coef( lm(d[,1] ~ d[,2]) )  ## calculate two coefficients and return
them
   }

   results <- mclapply( 1:10000, run )

stumped over something that should be easy...pointer appreciated.

/iaw
----
Ivo Welch (ivo.we...@gmail.com)

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to