R
Specifically regarding R code
Versions
Install Older Package from Source
# P: package name, e.g. "ggplot2"
# V: version number, e.g. "3.3.5"
#single install
install.packages(
"https://cran.r-project.org/src/contrib/Archive/<P>/<P>_<V>.tar.gz"
repos=NULL
, type="source"
,
)
#function to install (for multiple instances)
library(glue)
<- function(P, V){
install_old_version if (packageVersion(P) == V){
::log_info("Package already at that version")
loggerelse {
} <- as.character(glue(
packageurl "https://cran.r-project.org/src/contrib/Archive/{P}/{P}_{V}.tar.gz"
))install.packages(packageurl, repos=NULL, type="source")
::log_success("{P} {V}")
logger
} }
Install Older Version of R (Windows)
If a program was built entirely in an older version of R, it may be difficult to get it to work with an updated version of R. When their isn’t time to investigate and re-code, installing an older version of R is possible.
- cran.r-project.org
- Click the ‘Download for Windows’ link for your given operating system
- Click on the ‘base’ link
- Click on the ‘Previous releases’ link
- Click on the specific R version you want, say R 3.5.3
- Click on the ‘Download R
for Windows’ and this will download an exe file - Run the exe file to install the older version of R
Switch between versions of R
- Open R Studio
- Tools > Global Options…
- General > R Version > Change…