A drop down menu should pop up for you to select from (or you will get a bunch of numbers to choose from), whether you are using R in the terminal or an IDE such as RStudio. This is supported on Windows, Mac OS, and most Linux systems. However, it may require additional configuration or dependencies such as X-windows.
To enable X-windows when using remote access use the following -XY
flags:
ssh -XY [email protected]
There is often a default repo but this can be specified if you have any issue, such as running scripts or Rmarkdown/knitr. You can use the repo
opset the mirror or repository for CRAN each time you install with:
install.packages("package", repo="<your.nearest.mirror>")
It is advisable to use the nearest mirror to your location for faster downloads. For example:
install.packages("RMySQL", repos="https://cran.stat.auckland.ac.nz/")
You can also set the repos
option in your session so you only need to it once per interactive session (or script). You can check whether repos
is configured with:
options(repos)
If you get "Error in options(repos) : object 'repos' not found"
then you can set the repository option. For example:
options(repos = "https://cran.stat.auckland.ac.nz/")
Then it should work to install packages like usual. For Example:
install.packages("RMySQL")
As mentioned by others, you can configure the repository in your .Rprofile
file and have this work across all of your scripts. It's up to you whether your prefer these "global" options on your system or "local" options in your session or script. These "local" options take more time to use each session but have the benefit of making others able to use your scripts if they don't have your .Rprofile
.