R/rowid-data.R
raw| 1 | style_rowid <- function(x) { |
| 2 | style_hint(x) |
| 3 | } |
| 4 | |
| 5 | rif_shaft <- function(n, ...) { |
| 6 | new_pillar_shaft(list(row_ids = seq_len(n)), |
| 7 | width = as.integer(floor(log10(max(n, 1))) + 1), |
| 8 | class = "pillar_rif_shaft" |
| 9 | ) |
| 10 | } |
| 11 | |
| 12 | #' @export |
| 13 | format.pillar_rif_shaft <- function(x, width, ...) { |
| 14 | new_ornament( |
| 15 | style_rowid(format(x$row_ids, width = width)), |
| 16 | width = width, |
| 17 | align = "right" |
| 18 | ) |
| 19 | } |