3

I (finally) just installed ggplot2 by doing it from R directly and turning off antivirus. (It had previously failed out on moving the temp files for stringi and magrittr, so I followed the advice in StackOverflow.)

And it worked. But I have a few puzzles about its behaviour. The command I used was:

install.packages("ggplot2", repos = getOption("repos"), dependencies = TRUE)

Two things that happened as a result puzzled me:

  • it didn't ask me what repos I wanted to use - but just went to imperial (which is fine with me)

  • it didn't install the dependencies - which I discovered when I did
    library, so I installed the missing ones manually one by one (luckily there were only two - the two that had failed out when I had tried an install from RStudio with my antivirus on)

I have read the documentation on install.packages() but haven't understood it, as both these behaviours were different from what I expected. I thought I would get a query about what repos to go to, and I thought I would get the dependencies tagging along on the install.

Can someone explain?

Thanks.

Community
  • 1
  • 1
Heather Stark
  • 605
  • 7
  • 18
  • amazing for the dependencies. It should work fine. The only case I know that `install.package` ignore dependencies , is for `NULL repos`. – agstudy Sep 10 '15 at 11:50
  • I wonder if (trying) to set the repos interactively might ignore the dependency flag? – Heather Stark Sep 10 '15 at 18:08

1 Answers1

3

It always install dependencies. That is the whole point of

  1. having repos -- and why CRAN was so important over these 20 years, and
  2. declaring dependencies in DESCRIPTION.

Now, I set my repos in the startup file (Rprofile.site in my case, see help(Startup) and its examples section for how). You can also just call options() before calling install.packages(). The dependencies=TRUE is also superfluous.

But thinks you need to check and did not tell us: source or binary installation? What OS? What is your R version and does it mesh with what the repos expect -- a current version on R?

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Binary. Windows. 3.2.0, which isn't exactly up to date. Do you think it failed because I'm not on 3.3.2? – Heather Stark Sep 10 '15 at 16:55
  • Your answer clarifies the designed behaviour regarding dependencies, thanks. As to repositories, I have not set a default, but maybe it could be the case that having installed one package in my session already, having picked the repository from a pick list, that option would be set and stay set for the session (regardless of whatever indigestable stuff I was trying to tell it as parameters?) If so, the behaviour re. repositories makes sense. – Heather Stark Sep 12 '15 at 14:36