R/rowid-data.R

Defines functions format.pillar_rif_shaft rif_shaft style_rowid

style_rowid <- function(x) {
  style_hint(x)
}

rif_shaft <- function(n, ...) {
  new_pillar_shaft(list(n = n),
    width = as.integer(floor(log10(max(n, 1))) + 1),
    class = "pillar_rif_shaft"
  )
}

#' @export
format.pillar_rif_shaft <- function(x, width, ...) {
  new_ornament(
    style_rowid(format(seq_len(x$n), width = width)),
    width = width,
    align = "right"
  )
}

Try the pillar package in your browser

Any scripts or data that you put into this service are public.

pillar documentation built on July 29, 2021, 9:06 a.m.