Public-Health-Scotland / technical-docs

Technical documentation, including guidance and best practice for Public Health Scotland (PHS)

Home Page:https://public-health-scotland.github.io/knowledge-base/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

REQ - Add guidance on Package Manager

JFix89 opened this issue · comments

Describe what you'd like
Comprehensive guidance on Package Manager and potential use cases. Include guidance on package versions and compatibility with version of Posit Workbench in use at Public Health Scotland.

Additional context
The guidance below has been archived from the legacy FAQs on the PHS Data and Intelligence Forum Teams channel but could potentially be incorporated (or something similar):

### Issue: Error " is unavailable for R version..."

This error occurs when the R version PHS is running is out of date, and therefore some packages will depend on a newer version of R.
Other than 1) making sure you are using the most up to date R version on the server (there are multiple versions available) and 2) waiting for a more up to date version to be available in PHS the solution is to install an older version of the package you want:

Step1: go to the cran R page for the package in question (google cran R and you'll find the page)
The "depends" row tells you what version of R (minimum) it needs.

Scroll down to "archive" to follow the link to old sources

you cant see what the older versions depend on, but try and go with one that has a release date that isn't too long (within a year or 2 is usually OK) after the release date of the R version you are on:

the code to install is then:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/forestplot/forestplot_1.10.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
packageurl is made up of the url of the archive page plus the package version