1
Mac64 R>  install.packages("quantmod")

Yields a discouraging message. Namely,

Warning: unable to access index for repository http://www.ibiblio.org/pub/languages     /R/CRAN/bin/macosx/leopard/contrib/2.12
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘quantmod’ is not available

No big deal, just pass in a different repo, like this:

Mac64 R> install.packages("quantmod", repo="http://R.research.att.com")

And all is well. But how do you set the default repo so you don't need to pass it in every time? In Ubuntu, there is a file that manages this but the documentation for Mac OS X is a bit sparse.

Milktrader
  • 9,278
  • 12
  • 51
  • 69
  • There are discussions about a number of startup options, including repos, in [this question about .Rprofile](http://stackoverflow.com/questions/1189759/expert-r-users-whats-in-your-rprofile). – JD Long Dec 13 '10 at 12:35

3 Answers3

1

http://cran.r-project.org/doc/manuals/R-admin.html#Managing-libraries

Try creating the folders and files as suggested for UNIX-like systems; chances are that R will check for them on OS X as well when looking for repo settings.

Adam Vandenberg
  • 19,991
  • 9
  • 54
  • 56
  • I've read over that doc until my eyes glazed, and it doesn't point me to where I can set a default remote repo or replace my current default. – Milktrader Dec 13 '10 at 02:23
1

See the help for function setRepositories; you can manage your list of repositories in a GUI or by editing the file R_HOME/etc/repositories.

You can know what is your R_HOME directly in R:

> R.home()
[1] "/usr/lib/R"
ulidtko
  • 14,740
  • 10
  • 56
  • 88
1

Can't tell if you are using the R64.app GUI but guessing that you may not be. You can set the default repository in the r/Preferences/ panels if you are using R64.app. Personally I use the repository at the same facility that hosts StatLib which shows up on some dialogs something like USA (PA 1) but on my Preferences pane is http://lib.stat.cmu.edu/R/CRAN . Here is a bit of ?options that may be of interest:

repos:
URLs of the repositories for use by update.packages. Defaults to 
c(CRAN="@CRAN@"), a value that causes some utilities to prompt for 
a CRAN mirror. To avoid this do set the CRAN mirror, by something 
like local({r <- getOption("repos"); r["CRAN"] <- "http://my.local.cran"; 
options(repos=r)}).
Note that you can add more repositories (Bioconductor and Omegahat, notably)
 using setRepositories().

At the moment my "other repository" setting in the the R64.app is http://www.stats.ox.ac.uk/pub/RWin/bin/macosx/leopard/contrib/2.12/ , because I was doing something to get a package that was only at Ripley's site but it is usually set to R--Forge: http://r-forge.r-project.org/

IRTFM
  • 258,963
  • 21
  • 364
  • 487