You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pluralize fails for values outside ±.Machine$integer.max #773
When trying to compare integers (but not doubles) outside of ±.Machine$integer.max, R returns NA, causing pluralize to fail, as qty != 1 cannot be properly evaluated.
# This works
(.Machine$integer.max+1) !=1#> [1] TRUE# ...but this does not
as.integer(.Machine$integer.max+1) !=1#> Warning: NAs introduced by coercion to integer range#> [1] NA
pluralize reprex
cli::pluralize("{99} bug{?s} in the code")
#> 99 bugs in the coden_bugs<-99cli::pluralize("{n_bugs} bug{?s} in the code")
#> 99 bugs in the codecli::cli_inform(c("Take one down",
"And patch it up",
"You got"))
#> Take one down#> And patch it up#> You gotn_bugs<-.Machine$integer.maxcli::pluralize("{n_bugs} bug{?s}")
#> 2147483647 bugscli::pluralize("...add one more and it breaks: {n_bugs + 1} bug{?s}")
#> Warning in make_quantity(values$qty): NAs introduced by coercion to integer#> range#> Error in if (qty != 1) parts[1] else "": missing value where TRUE/FALSE neededcli::pluralize("It's not an issue if you aren't actually pluralizing something: n_bugs^2 is {n_bugs^2}")
#> It's not an issue if you aren't actually pluralizing something: n_bugs^2 is 4611686014132420608cli::pluralize("You can also go low: {-1L * .Machine$integer.max} bug{?s}")
#> You can also go low: -2147483647 bugscli::pluralize("...but not too low {-1L * .Machine$integer.max - 1} bug{?s}")
#> Warning in make_quantity(values$qty): NAs introduced by coercion to integer#> range#> Error in if (qty != 1) parts[1] else "": missing value where TRUE/FALSE needed
Activity