[R] handling a cancelled file.choose()
btupper at bigelow.org
Wed Jun 6 17:51:19 CEST 2007
I have a file reading function that prompts the user with a file dialog
if a filename is not provided in the argument list. It is desirable to
return gracefully if the user selects "Cancel", but file.choose() throws
an error instead of returning something like a character.
Error in file.choose() : file choice cancelled
I naively planned to use nchar() to test the length, assuming
cancellation would return a zero-length character. That appears to be
out of the question. Are there other options available in the base package?
More information about the R-help