if (require("testthat") && require("insight")) {
test_that("format_value", {
expect_equal(nchar(format_value(1.2012313)), 4)
expect_equal(format_value(4.2, protect_integers = TRUE), "4.20")
expect_equal(format_value(4.0, protect_integers = TRUE), "4")
expect_equal(format_value(0, protect_integers = TRUE), "0")
expect_equal(format_value(0), "0.00")
expect_equal(format_value(1234565789101112), "1.23e+15")
expect_equal(format_value(1234565789101112, protect_integers = TRUE), "1234565789101112")
expect_equal(format_value(0.0000000123), "1.23e-08")
expect_equal(format_value(0.0000000123, digits = 8), "0.00000001")
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.