CRAN Repository Selection
Summary
RStudio users encountering the "CRAN repositories modified outside package preferences" warning can resolve it by identifying and editing system-wide R configuration files. The issue arises when R's default package repository, often https://cloud.r-project.org on systems like Linux Mint, is set externally to RStudio's preferences. Investigation using getOption("repos") reveals the active repository. The solution involves editing /etc/R/Rprofile.site as root to comment out the conflicting repository setting. After this modification and an RStudio restart, the warning disappears, and RStudio defaults to https://cran.rstudio.com/. While R sessions outside RStudio will then prompt for a mirror selection, the fix addresses the primary RStudio warning.
Key takeaway
For RStudio users troubleshooting the "CRAN repositories modified outside package preferences" warning, you should investigate your system's global R configuration. Specifically, check getOption("repos") and modify /etc/R/Rprofile.site to remove conflicting repository definitions. This ensures RStudio respects your package preferences. Be aware that future R upgrades might overwrite this file, requiring you to re-apply the edit.
Key insights
The "CRAN repositories modified outside package preferences" warning indicates an external R configuration override.
Principles
- External R configuration files can override RStudio settings.
- getOption("repos") reveals the active CRAN repository.
- System-wide R settings are often in /etc/R/Rprofile.site.
Method
To resolve the "CRAN repositories modified outside package preferences" warning: 1. Run getOption("repos"). 2. Edit /etc/R/Rprofile.site (as root) to comment out conflicting settings. 3. Restart RStudio.
In practice
- Check getOption("repos") for active repository.
- Edit /etc/R/Rprofile.site to manage global R settings.
- Restart RStudio after configuration changes.
Topics
- RStudio
- CRAN Repositories
- R Package Management
- R Configuration
- Linux System Administration
Best for: IT Professional, Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by OR in an OB World.