Installing and using R in TSD

Help on usage, package installation, etc

Installing R

Project managers, who are members of the "pxxx-admin-group," can install applications from the Software Center.

Installing packages

Because workstations offered by TSD are deliberately (to help maintain security of project work) cut off from the Internet, including CRAN, we maintain local mirrors (copies) of the CRAN and Bioconductor repositories on the TSD network and additionally configure R (using a .Rprofile file), to allow for seamless package installation.

Linux

The install.packages command can be used for installing a hypothetical package called "fantasia", with all its dependencies:

install.packages("fantasia")

Windows

For Windows hosts that have R versions 4.0.3 or greater installed, the following applies for all versions of R on that host:

install.packages("fantasia")

Packages are by default installed somewhere where storage quotas and free space may run full. On Windows, for example, this may be the C: drive. Please tell us if you suspect the storage may have run full and we will help you rectify the problem.

If a another version of R is required, then the PI or and admin in the project can install it, as described on this page

When using versions of R before 4.0.3 you may need to configure R yourself for it to use our package repository mirrors (and thus be able to install mirrored packages) and to apply other required settings. These settings are available in the Rprofile.site file available in the \\tsd-evs\shared\R folder. To have the configuration applied automatically when R starts, you may copy the file into your home directory, renaming it to .Rprofile there. Alternatively you can source the file (once per every R session) with an R command line like source("\\\\tsd-evs\\shared\\R\\Rprofile.site") .

If packages fail to install

Sometimes packages will fail to install, usually because they are not offered in our mirrors, the installation procedure requires something from the Internet (e.g. Github packages), or because an external (build) library is missing. Installing these packages requires that you first find the "archive" version of the package and import it into TSD. The procedure is easier to explain with an example, below for a package called pystr:

  1. Find the archive of the package, starting at https://cran.r-project.org/web/packages/pystr/index.html, for instance.
  2. Download the archive, i.e. pystr_2.0.0.tar.gz
  3. Import the archive into TSD (please move it out of the import folder as it's not intended as a "work" folder)
  4. Install the package from [the archive] file, using either of the following methods:
    • With the Windows command prompt:
      R CMD INSTALL /path/to/some/dir/pystr_2.0.0.tar.gz
    • Through R:
      install.packages("/path/to/some/dir/pystr_2.0.0.tar.gz", repos = NULL, type = "source")

Build tools

Packages require build tools (gcc, make) to be build from source. Windows hosts need to have the "Rtools" software installed. Ask your project administrator to install Rtools from the Software Center on Windows hosts.

On Colossus most R modules have the needed dependencies in their toolchain. Contact us for help with installation of system dependencies on Linux login nodes.

When installing devtools please check if your VM has all the dependencies. you could use the command dnf grouplist "Development Tools" to make sure that the development tools are installed.

Please contact us for help if the development tools are not installed.

 

Github

Github repositories or package releases are usually compressed as .zip. These packages need to unzipped inside TSD and then installed. First make sure devtools is installed:

library("devtools")

If you get error message "There is no package called devtools", then install devtools like this:

install.packages("devtools")

Then use the following command to install the package:

devtools::install("path/to/some/unzipped/package/")

The stringi package

One package that is often problematic to install is stringi. To facilitate its installation, we offer it as an archive file under /tsd/shared/R (Linux) / \\tsd-evs\shared\R (Windows) folder:

install.packages("/tsd/shared/R/misc/stringi_1.4.6.tar.gz", repos = NULL, type = "source")

Rmarkdown

Windows hosts require "Miktex" to be installed to render markdown files as pdf. Ask your project administrator to install Miktex via Self-Service on Windows hosts.

Bundling packages "outside" TSD and importing these

TSD end users have created the tsdrtools R package to facilitate installing packages that are not readily available through TSD. The package downloads and bundles the software "outside" TSD, which you can then import into TSD and extract for use. Since this is a 3rd-party package not supported by TSD, you'll need to contact the package developers if you experience issues.

If you experience issues installing packages after following the above instructions, feel free to contact us for help with the installation, providing relevant details including the name of the package, download location and the name of the host (machine) for the installation.

 
Search the user manual
Contact support

Call us

Opening hours are weekdays from 08:30 to 17:00 and Saturdays from 10:00 to 15:00.

Phone number: 22 84 00 04

Register case

Your request can be sent to it-hjelp@uio.no.

Send email

Book a Zoom meeting

Students and employees can book a Zoom meeting with UiO Helpdesk. Available hours are Tuesday to Thursday between 11:00 and 13:00.

Book a video call

Chat with us

Our chat is open every weekday between 09:00 and 16:00.

Start chat
Did you find what you were looking for?
By Gard, Bj?rn-Helge, Sabryr, Bart, Armen
Published June 21, 2021 10:57 AM - Last modified Oct. 23, 2023 8:38 AM