Skip to content

Commit

Permalink
sanity check for format_value
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jun 28, 2023
1 parent 893353f commit 704ee19
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/format_value.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ format_percent <- function(x, ...) {
# proper character NA
if (is.na(.missing)) .missing <- NA_character_

# sometimes, digits can be `NULL` - sanity check
if (is.null(digits)) {
digits <- 2
}

if (is.numeric(x)) {
if (isTRUE(.as_percent)) {
need_sci <- (abs(100 * x) >= 1e+5 | (log10(abs(100 * x)) < -digits)) & x != 0
Expand Down

0 comments on commit 704ee19

Please sign in to comment.