CRAN Repository Selection

· Source: OR in an OB World · Field: Technology & Digital — Software Development & Engineering, Data Science & Analytics · Depth: Intermediate, quick

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

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

Topics

Best for: IT Professional, Software Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by OR in an OB World.