Reputation: 6331
I'm having a particularly hard time trying to get the 'fpc' package in R to install on Ubuntu 13.04.
The code I've written contains a line like:
install.packages('fpc') ; library(fpc)
which gives the output:
Error in contrib.url(repos, type) :
trying to use CRAN without setting a mirror
Calls: install.packages -> grep -> contrib.url
Execution halted
I haven't messed around with the .Rprofile file yet, and googling the issue reveals that this may be the cause (https://stat.ethz.ch/pipermail/r-devel/2009-October/055136.html) - the response here is pretty cryptic (and all I understand from this link is that I may not be setting a mirror).
Anyway, I've literally downloaded all packages from apt-get:
sudo apt-get install r-cran-*
and so far that hasn't fixed the issue. Any suggestions??
Thanks!
Upvotes: 5
Views: 9419
Reputation: 368261
If you do help(install.packages)
you can see how to set a CRAN site in the call itself. But for what it is worth, I use this line in my ~/.Rprofile
## Default repo
local({r <- getOption("repos");
r["CRAN"] <- "http://cran.r-project.org"; options(repos=r)})
which I have broken over two lines here for the formatting. Adjust as needed for a local mirror.
Upvotes: 3