Open n-kall opened 4 months ago
Looks like an issue with the check_existing_variables()
helper:
(check_existing_variables(c("mu", NA), example_draws()))
## [1] "mu" "mu"
Great, probably not too complex of a fix then. But I also wonder if it ever makes sense to allow NA in variable. Maybe there should be an input check disallowing this?
Yeah good point. The two options to my mind are:
check_existing_variables()
if any elements of variable
are NA
.ndraws(x)
of NA
for that entry in the output.I think I'd be fine with throwing an error since it probably isn't that useful to do variable subsetting by names with NA
s, and throwing an error would be simpler. Then if a use case arises for this later we could consider implementing it.
@mjskay I think your first suggestion (throwing an error if names includes NA) would make the most sense at this stage
When subsetting by variable, if
NA
is included in thevariable
argument along with other strings, the matched variables are duplicated in the output.Example: