# Oscar: R

## Loading and Launching R

1\. Once authenticated to Oscar, use the following commands at the command line.

2\. Start an interactive job by using the `interact` command. This command can take [additional parameters](https://docs.ccv.brown.edu/oscar/submitting-jobs/interact) to extend the resources and time allotted to the node as well as the partition that the node operates on.

3\. To load R, use `module load r/4.4.2-re5rjx3`, or another version of your preference (if running Oscar in PuTTY, pasting text is done by right-clicking).

4\. Once inside the container's shell, use `R` to launch the R console.

## Installing R packages 

1\. R packages need to be installed locally.

2\. First, load the R version that you want to use the package with: `module load r/4.2.2`.

3\. Start R Session `R`.

4\. For packages that require code to be complied, install them in the log in node. Refer to more information [here](https://docs.ccv.brown.edu/oscar/software/r-installs).

5\. To reinstall packages, start a new session by:

```
module load r/4.2.2
R
```

6\. Then, update packages with `update.packages(checkBuilt=TRUE, ask=FALSE)`.

7\. To uninstall packages, start an R session. Then run `remove.packages("wordcloud")`(word cloud can be replaced with string of another package name).