Utilizing multiple cores in R
There are a couple of options in R, if you want to utilize multiple cores on your machine. These days my favorite is doMC package, which depends on foreach and multicore packages.
in the section below squareroot for each number is calculated in parallel. Check the vignette for more complicated example. In practice, if you need to iterate through a large data structure and there is no escape from that, this package makes things considerably faster depending on how many cores you have access to in your machine.
> foreach(i = 1:3) %dopar% sqrt(i)
you can also choose how the resulting data structure is combined
> foreach(i = 1:3,.combine="rbind") %dopar% sqrt(i)
offers daily e-mail updates
news and tutorials
on topics such as: visualization (ggplot2
), programming (RStudio
, Web Scraping
) statistics (regression
, time series
) and more...
If you got this far, why not subscribe for updates
from the site? Choose your flavor: e-mail
, or facebook