strip0 | R Documentation |
Takes an object x
of class "character" or "numeric". Returns an
object of class "character" in which the leading zero has been removed.
By default, it also rounds the number-string that it returns to two
decimal places. Example: both 0.3445 and "0.3445" are transformed to
".34".
strip0(x, dp = 2)
x |
Object of class "character" or "numeric." |
dp |
Integer specifying the number of decimal places in the returned string. Can be NULL, in which case no rounding is performed. |
If x
has no leading zero, the returned object is still rounded to
dp
decimal places.
strip0("0.346") # ".35" strip0(0.346) # ".35" strip0(.346) # ".35" strip0(5.346) # "5.35" strip0(c("0.789", ".2346", 53.3, 53.346)) # c(".79", ".23", "53.3", "53.35")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.