Post #2951153
2023-08-08 07:32 UTC
@djnavarro@fosstodon.org Awesome post, I think I have lots to learn from this, especially about the tabular data at the end. One addition if I may: stopifnot can produce informative messages. You have to provide it in the named arg way, like
stopifnot(“Value is not scalar” = length(value) == 1)
I’ve been using this method for asserting that inputs to functions are robustly checked. It can get ugly. But there’s no package dependencies… but maybe a minimum R version 🤔 I can’t remember when it was introduced.
Replies (1)
-
@djnavarro@fosstodon.org 2023-08-08 07:35
@jimgar@fosstodon.org Huh. I’ve been using stopifnot() for years and never realised I could do that! Okay I’ll update the post to reflect that - thanks!