I'm trying to run R in parallel to run a regression. I'm trying to use the snowfall library (but am open to any approach). Currently, I'm running the following regression which is taking an extremely long time to run. Can someone show me how to do this?
sales_day_region_ctgry_lm <- lm(log(sales_out+1)~factor(region_out)
+ date_vector_out + factor(date_vector_out) +
factor(category_out) + mean_temp_out)
I've started down the following path:
library(snowfall)
sfInit(parallel = TRUE, cpus=4, type="SOCK")
wrapper <- function() {
return(lm(log(sales_out+1)~factor(region_out) + date_vector_out +
factor(date_vector_out) + factor(category_out) + mean_temp_out))
}
output_lm <- sfLapply(*no idea what to do here*,wrapper)
sfStop()
summary(output_lm)
But this approach is riddled with errors.
Thanks!