R/pillar.R

Defines functions pillar_shaft.tf obj_sum.tf type_sum.tf

Documented in obj_sum.tf pillar_shaft.tf type_sum.tf

#-------------------------------------------------------------------------------

## tibble methods:
# adapted from https://github.com/r-spatial/sf/blob/master/R/tidyverse.R

#' Format tidy functional data for tibbles
#'
#' Summarize tidy functional data for tibble
#' @param x object of class tf
#' @param ... ignored
#' @rdname tftibble
#' @family tidyfun print
#' @importFrom pillar type_sum obj_sum pillar_shaft
#' @details see [pillar::type_sum()]
type_sum.tf <- function(x, ...) {
  class(x)[2]
}

#' @rdname tftibble
obj_sum.tf <- function(x) {
  paste0(type_sum.tf(x), "[", length(x), "]")
}

#' @rdname tftibble
pillar_shaft.tf <- function(x, ...) {
  digits <- options("pillar.sigfig")$pillar.sigfig
  if (is.null(digits)) {
    digits <- options("digits")$digits
  }
  out <- format(x, width = 30L, digits = digits, prefix = FALSE, ...)
  pillar::new_pillar_shaft_simple(out, align = "right", min_width = NULL)
}

Try the tidyfun package in your browser

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

tidyfun documentation built on April 24, 2026, 5:06 p.m.