-
-
Save cbrown5/f47508bd01094adc967dcb4544569162 to your computer and use it in GitHub Desktop.
Tips for setting up R packages on windows 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Written by Chris Brown at Griffith Uni | |
#Tips for setting up R packages on windows 10 | |
I recommend installing packages to your local drive, not the shared network drive. Though R will default to the network drive (which is "\\\\staff\..."), so some knowledge is required to overcome this. | |
You could also ask IT to bind a letter to your network drive. I've read that works (see here: https://github.com/r-lib/devtools/issues/353) | |
Here's the steps I followed to install packages: | |
Create a shortcut to R on desktop. | |
Right click it | |
Select properties then security tab. | |
Then give yourself permission for "Full control" and "Modify" | |
Then use this shortcut to install packages. Most packages can just be installed normally, but some packages that are widely used by others will only be found if installed to the C drive. | |
So I opened this shortcut and used: | |
install.packages(c("Rcpp", "RcppArmadillo"), lib = .libPaths()[2], dependencies = TRUE) | |
The command ".libPaths()[2]" ensures it installs to C drive, not the Y drive. | |
to install such packages (examples are Rcpp, RcppArmadillo, dplyr, tidyr, ggplot2 etc) | |
#Installing Rtools | |
You will need Rtools to compile packages from source. e.g. if you want to get packages off of github, or there isn't source available on cran. | |
Go to https://cran.r-project.org/bin/windows/Rtools/ and get the latest Frozen version. | |
Now run the .exe to install. Make sure you click the tick box to modify the PATH. | |
To check it has worked open R and type: | |
Sys.getenv('PATH') | |
There should be some directories for Rtools in the returned text. | |
I had troubles with getting Rtools to install, it seemed it would install fine, but couldn't modify the PATH. So I had to get IT to come and give me admin rights. Then the install worked. | |
The source package I was trying to install also relied on Rcpp and RcppArmadillo, which I had to reinstall as above. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment