Skip to content

Instantly share code, notes, and snippets.

@alexpghayes
Created December 18, 2020 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexpghayes/e0ca073852d067a3cf4d7a25673d8018 to your computer and use it in GitHub Desktop.
Save alexpghayes/e0ca073852d067a3cf4d7a25673d8018 to your computer and use it in GitHub Desktop.
left_padded_sequence <- function(x) {
original <- withr::with_options(
c(scipen = 999),
as.character(x)
)
max_digits <- max(vapply(original, nchar, integer(1)))
formatC(x, width = max_digits, format = "d", flag = "0")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment