Bug 17242 - cancel as 3rd option for install.packages() when binary is not (yet) available and some more
Summary: cancel as 3rd option for install.packages() when binary is not (yet) availabl...
Alias: None
Product: R
Classification: Unclassified
Component: Wishlist (show other bugs)
Version: R-devel (trunk)
Hardware: All All
: P5 enhancement
Assignee: R-core
Depends on:
Reported: 2017-03-19 09:48 UTC by k_bugzilla
Modified: 2017-04-27 18:50 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description k_bugzilla 2017-03-19 09:48:36 UTC
When using update.packages(ask = TRUE), users are prompted with three options when a newer version is available (e.g. on CRAN):
Update (y/N/c)?
-> can we have a bit more explanation what the letters stand for, like:
Update ((y)es/(N)o/(c)ancel)?

There is no cancel option for install.packages(). So, when a new package version without a binary package is found in the repository (e.g. CRAN), users are prompted with just to options: whether to try to install from sources or not:

(y)es will try to install from sources (and maybe compile something).
(n)o will just install the old version again.

I believe, a 3rd option ((c)ancel) would be very handy here, because we do not need to re-install the old version package in case the binary version is not yet available. This would also save bandwith for the CRAN mirrors (if used, of course).
Comment 1 Duncan Murdoch 2017-04-19 11:48:03 UTC
 Consistency on questions like this is desirable, and we don't currently have that, so I agree some changes are in order.

I've looked through the base sources for what the prompts are like.  I found

(y/N/x)   # apparently a typo, (y/N/c) intended

There are also calls on Windows to the winDialog function, which seems somewhat inconsistent in its behaviour:  winDialog("ok", "message") allows the dialog to be cancelled, but returns NULL whether cancelled or not; winDialog("yesno", "message") (the only version we appear to use) returns "YES" or "NO", but doesn't allow cancellation.

We do have a local function ask.yes.no() in install.packages(); I think the best solution here would be to export a function like that and use it consistently. But if it's exported, it needs to be carefully designed (e.g. front ends like RStudio may want to be able to replace it with their own dialog).  So for now I'm going to fix the typo, and ask on R-devel for contributions of such a function.
Comment 2 Duncan Murdoch 2017-04-27 18:50:11 UTC
I have added a new function askYesNo() to R-devel, and used it in base packages where they were asking yes/no questions.  This should make them consistent.  Comments on the details are welcome.