R/AllGenerics.R
R/autopadZeros-methods.R
autopadZeros.Rd
Autopad zeros
autopadZeros(object, ...) # S4 method for class 'character' autopadZeros(object) # S4 method for class 'integer' autopadZeros(object)
Object.
Additional arguments.
character.
character
Updated 2023-09-21.
stringr::str_pad().
stringr::str_pad()
## integer ==== autopadZeros(c(1L, 10L, 100L)) #> [1] "001" "010" "100" ## character ==== ## Left side. autopadZeros(c("1-EV-DMSO", "10-EV-DMSO", "2-EV-DMSO-B")) #> [1] "01-EV-DMSO" "10-EV-DMSO" "02-EV-DMSO-B" ## Right side. autopadZeros(c("A1", "B10", "C100")) #> [1] "A001" "B010" "C100"