Skip to content
Prev 325543 / 398503 Next

load() into a data frame with my chosen name => .ThisEnv ?

For your problem, you might want to use saveRDS and readRDS instead of
save and load. I would also use dir to get a list of files rather
than paste. 

Then your solution might look like:


run <- function(filename) {
    df <- readRDS(filename);
    coef( lm(df[,1] ~ df[,2]) ) 
}

results <- lapply( dir(pattern=glob2rx('d*.rds')), run)

If this is disk-bound, using multiple threads probably won't help much.
You'll have to try it out for yourself.

-nfultz
On Mon, Jun 17, 2013 at 04:07:50PM -0700, ivo welch wrote: