pad.zero | R Documentation |
Pads each element of a numeric vector, or a vector that can be coerced to
numeric, so that it is a string of a minimum width
by adding leading
0s.
pad.zero(x, width)
x |
a numeric vector or vector that can be coerced to numeric. |
width |
minimum width desired for each string. |
Non-integers are truncated towards 0.
For negative integers, the negative sign is counted towards the string length.
Integers that are already as long or longer than width
are unaffected.
character vector of digit strings in which 0s have been prepended to
each string to make it at least width
characters long.
pad.zero(c('3','80','155'), width=2) pad.zero(20, width=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.