This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
r_antsr_usage [2016/03/23 21:01] mgstauff created |
r_antsr_usage [2017/04/10 20:28] (current) mgstauff [Local/User Package Installation] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== R ===== | ===== R ===== | ||
| - | ==== package installation issue ==== | + | ==== Local/User Package Installation |
| + | As of R 3.2, R should create a default location for local libraries (i.e. that you install on your own). Check using the '' | ||
| + | R_LIBS_USER will by default be the first line shown by '' | ||
| + | |||
| + | **HOWEVER** if you define R_LIBS, it will be used before R_LIBS_USER in search and installation paths. This can be confusing. For installation, | ||
| + | |||
| + | Some documentation here: | ||
| + | https:// | ||
| + | |||
| + | |||
| + | ==== Managing Packages ==== | ||
| + | |||
| + | Managing packages: | ||
| + | |||
| + | R can read packages from any of the locations listed in .libPaths(). This typically contains both a system directory (under / | ||
| + | |||
| + | To avoid this, use the packrat package (https:// | ||
| + | |||
| + | Packages that don't affect the outcome of studies, like roxygen2 or ggplot2, can be defined as " | ||
| + | |||
| + | ==== '' | ||
| + | |||
| + | When installing a package using an https URL, you may see this: | ||
| + | |||
| + | > install.packages(" | ||
| + | Installing package into ‘/ | ||
| + | (as ‘lib’ is unspecified) | ||
| + | Warning: unable to access index for repository https:// | ||
| + | unsupported URL scheme | ||
| + | |||
| + | This seems to be an R issue relating to SSL/HTTPS connections. | ||
| + | Here's a workaround: | ||
| + | |||
| + | options(download.file.method = " | ||
| + | | ||
| + | This will tell R to use the '' | ||
| ===== ANTsR ===== | ===== ANTsR ===== | ||
| Line 9: | Line 44: | ||
| ==== Installing from R ==== | ==== Installing from R ==== | ||
| - | (Thanks to Phil Cook!) | + | (Thanks to Phil Cook! Updated 4/2017) |
| Setup in your '' | Setup in your '' | ||
| - | export PATH=/ | + | export PATH=/ |
| - | + | ||
| - | export R_LIBS=/ | + | |
| Then on chead | Then on chead | ||
| [...]# R | [...]# R | ||
| + | | ||
| > install.packages(" | > install.packages(" | ||
| > library(devtools) | > library(devtools) | ||
| - | > install_github(" | ||
| > install_github(" | > install_github(" | ||
| + | > install_github(" | ||
| > install_github(" | > install_github(" | ||
| + | | ||
| + | |||
| + | |||