Closed moodymudskipper closed 5 years ago
Actually using tracing we can do :
tracing(is.logical(na.rm) || warn(sprintf("na.rm is of type %s and will be coerced to logical", typeof(.))))$mean(1:3, na.rm = foo)
which is more flexible and reads better for complex cases., so we can keep the simple version, and suggest the syntax above in the help file.
maybe better use enclosing
than tracing
in this case as we are not updating these values
done, with slightly different implementation
functions don't always do all the checks we'd want, we can do them separately but it's verbose and checks aren't directly connected to the function call.
stop_if_not
match.arg
We could think of how to incorporate custom errors by entering a list of length 2 with the above as the first element and an error text as a second element, but let's think more first because if we complexify the function we might want to let user choose between warnings or errors.
Something like
text could also be a function (or formula) of the given value