Bug 16074 - choose.files() inconsistent return for "cancel"
Summary: choose.files() inconsistent return for "cancel"
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Windows GUI / Window specific (show other bugs)
Version: R 3.1.2
Hardware: All Windows 64-bit
: P5 trivial
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-11-17 20:32 UTC by Bill Evans
Modified: 2014-11-18 19:58 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Evans 2014-11-17 20:32:19 UTC
With the default of `multi=TRUE`, `choose.files()` returns `character(0)` when the user presses Cancel. However, with `choose.files(multi=FALSE)` and the user presses Cancel, it returns a zero-length string, `""`.

As an example, both times I press "Cancel":

```r
choose.files()               # press Cancel
## character(0)
choose.files(multi = FALSE)  # press Cancel
## [1] ""
```

Based on the verbiage in the Rd: *"If the user cancels the dialog, then zero files are returned"*, I would expect the following behavior:

```r
choose.files()               # press Cancel
## character(0)
choose.files(multi = FALSE)  # press Cancel
## character(0)
```

This could be interpreted as a bug in the code or an inconsistency in the documentation; I see it more as the former.

I truly appreciate the efforts of the R dev team. Thank you for your continued efforts!

-bill
Comment 1 Duncan Murdoch 2014-11-18 19:58:02 UTC
I agree it's a bug; will fix in R-devel and R-patched.  Thanks for the report.