-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in if (revision < 57) { : missing value where TRUE/FALSE needed #42
Comments
I get the same error while following the demo (https://chrisschuerz.github.io/SWATplusR/articles/SWATplusR.html#loading-demos), and running: q_sim_plus <- run_swatplus(project_path = path_plus, |
@gopalpenny Thanks for pointing that out! You are right. and I will add the fix in the code. |
Makes sense, thanks for adding the fix! |
TLDR:
The string pattern in the
check_revision
function may require a question mark (i.e., question mark inserted after\\.
as:"[:digit:]{1,}\\.?[:digit:]"
) so that it still matches if there is no period in the SWAT version number. I attempted to debug the problem while drafting the full post, which is why it's much longer.Full post:
I've been having trouble getting SWATplusR to run, in particular the function
run_swatplus
. I had to install usingremotes::install_github("chrisschuerz/SWATplusR")
because I got an error when attemping to install from CRAN (the error indicated that the package would not work with my version of R, which is 4.0.3). With that said, the github version seemed to install without problem. The following works:But when I run the code:
I get the following error message (and warning):
The error message occurs within the
translate_outfile_names()
function. But the problem seems to be with thecheck_revision()
function, which returnsNA
. If it's helpful, the values of the function input variables forcheck_revision()
are:Finally, a bit more digging suggests that the version number only matches if there is a period ".". Instance, the result of
check_revision
up untilstr_extract(., "[:digit:]{1,}\\.[:digit:]")
is" 57 "
. Running thestr_extract
code as is produces:For me this is fixed by adding a question mark as:
The text was updated successfully, but these errors were encountered: