-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
Description
I just had a bug in my code, but it was hard to track down due to an unclear error.
What I just did was, in essence, the following:
> set_units(NA_real_, NA_character_, mode="standard")
Error: is.language(x) is not TRUEI thought that I was getting the error because I wasn't using mode="standard", but it really was due to the NA_character_.
I have two thoughts:
- If both the
xandvalueoptions toset_unitsareNA, couldNAbe returned? (That could easily be a bad idea for several reasons, and I don't have a strong opinion if the answer is a resounding no.) - Could the
Error: is.language(x) is not TRUEerror be clarified? I thought I was making it clear that I wasn't sending in a language object when I gaveNA_character_, so the error didn't make sense to me. (Admittedly, I wasn't intentionally sending inNA_character_.)
A simple fix for option 2 above could possibly be changing the stopifnot(is.character(x), length(x) == 1) at the top of as_units.character to stopifnot(is.character(x), length(x) == 1, is.na(x)).