Can I say that the R plyr package runs in parallel by default?

I am doing some analysis something like this:

library(plyr) input.files <- c("file1.txt", "file2.txt", "file3.txt") input.data <- llply(input.files, load.file, .parallel=TRUE) step.one.results <- llply(input.data, step.one, .parallel=TRUE) step.two.results <- llply(step.one.results, step.two, .parallel=TRUE) ... step.N.results <- llply(`step.N-1.results`, step.N, .parallel=TRUE) ... 

Is there a way to make all plyr functions parallel by default, so I don't always need to specify .parallel=TRUE for each step?

+5
source share
1 answer
 library(Defaults) setDefaults(llply, .parallel=TRUE) 

You will need to setDefaults for each function for which you want to change the standard formats. You can put this in your .Rprofile if you want.

You can also use formats directly. e.g. formals(llply)$.parallel <- TRUE should work.

+9
source

All Articles