Activity
Is there a problem with the following situation ?
> QupstrUnit <- NULL > match.arg(arg = QupstrUnit, choices = c("mm", "m3", "m3/s", "l/s", "L/s")) [1] "mm"
It's maybe exaggerated but we should prevent that a
NULL
value make a choice be default that it is not known by the user. I suggest to adopt one of these solutions:if(is.null(QupstrUnit)) stop("QupstrUnit should be one of \"", paste(choices, collapse = "\", \""), "\"")
if(is.null(QupstrUnit)) warning("'QupstrUnit' has been redefined to \"mm\"")
Edited by Dorchies DavidUsing
tolower(QupstrUnit)
fixed it and it allows to be flexible in the respect of the case of characters.> match.arg(arg = tolower(NULL), choices = c("mm", "m3", "m3/s", "l/s")) Error in match.arg(arg = tolower(NULL), choices = c("mm", "m3", "m3/s", : 'arg' doit être un de “mm”, “m3”, “m3/s”, “l/s” > match.arg(arg = NULL, choices = c("mm", "m3", "m3/s", "l/s")) [1] "mm"
I wasn't shocked by the previous behavior, because that's how the
match.arg()
function usually works.And it is a normal behavior in R to return the default value if the NULL value is used.
Edited by Delaigue Olivier
Nope. Nothing has changed. But it really seems to be an issue with the R version installed on the server.
I'm currently updating "patched version" because it still was v4.0.0 that I had compiled myself last year. I added the cran repository on my debian and update to v4.0.5 to not depend on a compiled version of R from source which is always a real challenge to manage...
I keep you in touch.
Found why in https://cran.r-project.org/web/packages/devtools/news/news.html:
devtools 2.4.0
Breaking changes and deprecated functions
The check_results() function has been removed. It was not used by any CRAN package, and much better alternatives are available in the rcmdcheck package.
It seems that I have solved this issue (and by the way again simplified the CI process): https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/commits/86-gitlab-ci-correctly-handle-warning-and-note-in-checks/.gitlab-ci.yml
Like the French people say: "Encore une victoire de canard!"
Also change it in the README file! #114 (closed)
Edited by Delaigue Olivier
mentioned in commit 795efbb6