strPad | R Documentation |
Pad a string to minimum width
strPad(x, width, side = c("left", "right"), pad = " ")
x |
|
width |
|
side |
|
pad |
|
character
.
Updated 2023-09-21.
stringr::str_pad()
.
sprintf()
.
https://stringr.tidyverse.org/articles/from-base.html
x <- c("1", "10", "100")
width <- max(nchar(x))
x <- strPad(x = x, width = width, side = "left", pad = "0")
print(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.