Skip to content

Running R on the new cluster in VS Code (bonus: installing terra)

How to test R scripts on log in node in VS Code?

  1. To access the cluster, follow the steps in the Wiki entry on How to access the new HPC2024.
  2. In the integrated terminal, run module purgeand then module R/4.3.2 to activate R. You can access R by typing R into the console and escape with Strg+Z
  3. In R, install languageserver: install.packages("languageserver")
  4. Install the R extension for VS Code (search REditorSupport)
  5. Create an R script and run lines with Strg+Enter. At first, this will create a new console where you might have to log in again via the ssh hpc.pik-potsdam.decommand and repeat step 2

Important: Only use the login node to install packages and test small bits of code. Never run heavy computations!

Bonus: How to install the terrapackage

First, turn to the related FAQ on this matter. However, if this does not work for you:

  • module purge
  • module load R/4.3.2 proj geos gdal sqlite3 hdf5/1.14.3 netcdf-c/4.9.2
  • inside R: install.packages("terra")