fmt_int | R Documentation |
Converts an integer value or vector of integer values into string(s) without any decimal point, padding them with a leading character to ensure they are all the same length.
fmt_int(num, tol = 1e-08, pad_char = " ", preserve_names = FALSE)
num |
An integer vector of values to be converted (these do not need to
be of class |
tol |
The numerical tolerance used to check whether a double can be safely converted to an integer. |
pad_char |
The character to use for (left) padding to ensure same-length output. |
preserve_names |
TRUE to preserve names from the input vector, FALSE otherwise. |
A character vector of formatted integer values, left-padded to the length of the largest value with the specified padding character.
fmt_int(2) # => "2" fmt_int(2.0) # => "2" fmt_int(2.00001, tol = 1.0e-4) # => "2" fmt_int(c(2, 467, 25)) # => [1] " 2" "467" " 25" fmt_int(c(2, 467, 25), pad_char=".") # => [1] "..2" "467" ".25" fmt_int(c(a = 1, b = 20), preserve_names = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.