Otago Study Group SYSKA

The OtagoStudyGroup Stuff You Should Know About blog

Parallel install of R packages

This came up in my twitter feed from Rbloggers and looks pretty useful as a set and forget type thing.

See https://www.r-bloggers.com/speeding-up-package-installation-2/ for the actual post

Basically, install.packages() uses the environment setting for Ncpus, which by default is set to 1.

The current setting can be found with

# the second argument returns 1 if Ncpus is not set, instead of NULL
getOption("Ncpus", 1L)

Ncpus can be set with this command before running install.packages()

options(Ncpus = 4)

Or you can stick it ‘~/.Rprofile’ so that it is loaded each time you run R


Share