Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some users had reported issues when reading files using
read_gasex_file
. After looking in to these issues, it was found that these users were directly copying the example code likeand replacing
ball_berry_1.xslx
andball_berry_2.xlsx
with their own file names.This had a very confusing and unexpected result. First,
system.file
returned an empty string because it could not find the specified file. Then,read_gasex_file
interpreted the empty string as if it were a plaintext Licor Li-6800 log file name. Eventually it encountered a problem when callingread.delim
, and reported an unhelpful error message likeError in if (skip > 0L) readLines(file, skip) : argument is of length zero
.This PR addresses this problem in several ways:
read_gasex_file
now returns a helpful error message if thefile_name
input is an empty string.system.file
now all specifymustExist = TRUE
. With this option, an error is generated if the file cannot be found, instead of the default behavior of returning an empty string.system.file
should not be used for loading the user's own files.Hopefully now users will no longer copy the
system.file
command. If they do, they will probably also copy themustExist = TRUE
option, which will cause a more direct error message explaining that the file cannot be found. If a user somehow persists in passing an empty string toread_gasex_file
, it will also produce a more informative error message.