tests/testthat/helper-unknown-rows.R

as_unknown_rows <- function(x) {
  x <- as_tibble(x)
  class(x) <- c("unknown_rows", class(x))
  x
}

dim.unknown_rows <- function(x) {
  c(NA_integer_, length(x))
}

registerS3method("dim", "unknown_rows", dim.unknown_rows)

head.unknown_rows <- function(x, n) {
  head(as.data.frame(x), n)
}

registerS3method("head", "unknown_rows", head.unknown_rows)

Try the tibble package in your browser

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

tibble documentation built on March 31, 2023, 11 p.m.