R-Studio Package Management
Updates to R packages rarely time up with our terms, often requiring updates to either R or other packages in the middle of the semester causing lost time in the classroom. The instructions below include how to point R-Studio to specific releases of packages, as well as getting the latest packages from CRAN.
CRAN Latest - RStudio
In the case that a package isn't updated in the Latest Packages Repository, the link is malfunctioning, or the link was lost you can use the Global CRAN repository to fulfill your R packages needs.
- Open RStudio
- Navigate to Tools > Global Options...
- On the Options menu, click on Packages located on the left-hand menu
- Under Primary CRAN repository, click Change
- Under CRAN Mirrors, click on Global (CDN) - RStudio
- Click OK
- Click Apply
Installing Older Versions of Packages
Using Devtools to Install Older Package Versions
- Open RStudio
- Click on File > New File > R Script
- In the script window, type require(devtools). Then on the next line type, install_version(package name, version = #, repos = "http://cran.us.r-project.org")
- Example: install_version("ggplot", version = "0.9.1", repos = "http://cran.us.r-project.org")
Installing an Older Package From Source
- Open RStudio
- Click on File > New File > R Script
- In the script window, type packageurl ← package url. Then on the next line type, install.packages(packageurl, repos = NULL , type = "source")
- Example:
- packageurl ← "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz"
- install.packages(packageurl, repos=NULL, type="source")
- Example: