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(row_ids = seq_len(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(x$row_ids, 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 March 31, 2023, 10:19 p.m.