#' Generate an Sequence of Numbers with Even Character Counts.
#'
#' Create a numerical sequence that doesn't order (e.g.) order 10 before 2.
#' @param seq A sequence of values required prepended zeroes.
#' @keywords sequence order numbers
#' @export
#' @import magrittr
#' @examples
#' order_paste(seq = 2:11)
#' [1] "02" "03" "04" "05" "06" "07" "08" "09" "10" "11"
order_paste <- function(seq) {
zeroes <- nchar(max(seq)) - nchar(seq)
lapply(X = 1:length(seq),
FUN = function(n) {
if ( zeroes[n] > 0 ) {
paste(rep(x = '0',
each = zeroes[n]),
collapse = '') %>%
paste0(seq[n],
collapse = '')
} else { ( seq[n] ) }
}) %>%
unlist
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.