Nothing
# WARNING - Generated by {fusen} from dev/flat_summary.Rmd: do not edit by hand # nolint: line_length_linter.
test_that("format_digits formats numbers, percentages and NaN", {
d <- data.frame(a = c(0.1234, NA, NaN), b = c("x", "y", "z"))
res <- format_digits(d, digits = 1)
expect_identical(res$a, c("0.1", NA, "NaN"))
expect_identical(format_digits(d, digits = 1, nan_as_na = TRUE)$a, c("0.1", NA, NA))
expect_identical(format_digits(d, cols = 1, digits = 0, percentage = TRUE)$a[1], "12%")
expect_identical(d$a[1], 0.1234) # input untouched
})
test_that("format_digits validates digits and cols", {
expect_error(format_digits(iris, digits = c(1, 2)), "single integer")
expect_error(format_digits(iris, digits = -1), "single integer")
expect_warning(format_digits(iris, cols = c(1, 5)), "not numeric")
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.