Automatically pads elements of a column to the largest sized element. Useful when an integer code with leading zeros is read in as an integer and needs to be fixed.

pad_auto(mdb, ..., side = "left", pad = "0")

Arguments

mdb

data frame

...

tidyselect specification

side

str_pad side

pad

str_pad pad

Value

data frame

Examples


# good for putting leading 0's

tibble::tibble(x = 1:10) %>%
  pad_auto(x)
#> # A tibble: 10 × 1
#>    x    
#>    <chr>
#>  1 01   
#>  2 02   
#>  3 03   
#>  4 04   
#>  5 05   
#>  6 06   
#>  7 07   
#>  8 08   
#>  9 09   
#> 10 10