(This article was first published on

** jottR**, and kindly contributed to

R-bloggers)
The below code shows how to configure the ‘repos’ option in R such that install.packages() etc will locate the packages without having to explicitly specify the repository. Just add it to the .Rprofile file in your home directory (iff missing, create it). For more details, see help(“Startup”).

local({

repos <- getOption("repos");

# http://cran.r-project.org/

# For a list of CRAN mirrors, see getCRANmirrors().

repos["CRAN"] <- "http://cran.stat.ucla.edu";

# http://www.stats.ox.ac.uk/pub/RWin/ReadMe

if (.Platform$OS.type == "windows") {

repos["CRANextra"] <- "http://www.stats.ox.ac.uk/pub/RWin";

}

# http://r-forge.r-project.org/

repos["R-Forge"] <- "http://R-Forge.R-project.org";

# http://www.omegahat.org/

repos["Omegahat"] <- "http://www.omegahat.org/R";

options(repos=repos);

})

*Related*

To

**leave a comment** for the author, please follow the link and comment on their blog:

** jottR**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as:

Data science,

Big Data, R jobs, visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...