fmt_leading_zero | R Documentation |
Format numbers to remove leading zeros
fmt_leading_zero(xs)
xs |
a vector of numbers or a character vector representing numbers |
APA format says that values that are bounded between [-1, 1] should not be formatted with a leading zero. Common examples would be correlations, proportions, probabilities and p-values. Why print the digit if it's almost never used?
Zeros are printed to match the precision of the most precise number. For
example, c(0, 0.111)
becomes c(.000, .111)
the vector with leading zeros removed. This function returns a warning if any of the values have an absolute value greater than 1.
fmt_leading_zero(c(0, 0.111))
fmt_leading_zero(c(0.99, -0.9, -0.0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.