Skip to content

Commit

Permalink
Fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
edelarua committed Sep 25, 2023
1 parent 8afa7b6 commit ae10aa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/formatting_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ format_xx <- function(str) {
#' @export
format_sigfig <- function(sigfig, format = "xx", num_fmt = "fg") {
checkmate::assert_integerish(sigfig)
format <- gsub("xx\\.|xx\\.x+", "xx", format)
checkmate::assert_choice(format, c("xx", "xx / xx", "(xx, xx)", "xx - xx", "xx (xx)"))
function(x, ...) {
if (!is.numeric(x)) stop("`format_sigfig` cannot be used for non-numeric values. Please choose another format.")
num <- formatC(signif(x, digits = sigfig), digits = sigfig, format = num_fmt, flag = "#")
num <- gsub("\\.$", "", num) # remove trailing "."
fmt <- gsub("xx\\.|xx\\.x+", "xx", format)

format_value(num, fmt)
format_value(num, format)
}
}

Expand Down

0 comments on commit ae10aa8

Please sign in to comment.