8

When running update.packages() in R how do I avoid answering "do you want to update this package" a hundred times?

update.packages() asks me individually if I want to update nearly every package I have with the prompt shown as y/n/c. I end up hitting Y then Enter repeatedly for five minutes. What does the "C" mean? Does it get me around this problem? I don't dare choose that option not knowing what it means. Y is obviously Yes and N is obviously No. C? Anybody's guess?

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
stackinator
  • 5,429
  • 8
  • 43
  • 84

1 Answers1

21

See in the help for update.packages (?update.packages):

ask: logical indicating whether to ask the user to select packages before they are downloaded and installed, or the character string "graphics", which brings up a widget to allow the user to (de-)select from the list of packages which could be updated. (The latter value only works on systems with a GUI version of select.list, and is otherwise equivalent to ask = TRUE.)

So the behaviour you are expecting can be accomplished with the following:

update.packages(ask = FALSE)

The c in y/n/c simply means cancel and stops the update process completely. Another trick to speed things up is to set the number of cores used for installing packages: e.g., update.packages(ask = FALSE, Ncpus = 3L).

JBGruber
  • 11,727
  • 1
  • 23
  • 45