| 1 |
as_unknown_rows <- function(x) { |
| 2 |
x <- as_tbl(x) |
| 3 |
class(x) <- c("unknown_rows", "tbl") |
| 4 |
x |
| 5 |
} |
| 6 |
|
| 7 |
local_unknown_rows <- function(frame = caller_env()) { |
| 8 |
local_methods( |
| 9 |
.frame = frame, |
| 10 |
tbl_nrow.unknown_rows = function(x, ...) { |
| 11 |
NA_integer_ |
| 12 |
}, |
| 13 |
as.data.frame.unknown_rows = function(x, ...) { |
| 14 |
class(x) <- "data.frame" |
| 15 |
x |
| 16 |
}, |
| 17 |
dim.unknown_rows = function(x) { |
| 18 |
stop("Do not query dim()") |
| 19 |
}, |
| 20 |
head.unknown_rows = function(x, n) { |
| 21 |
class(x) <- "data.frame" |
| 22 |
head(x, n) |
| 23 |
}, |
| 24 |
tbl_sum.unknown_rows = function(x) { |
| 25 |
c("Unknown rows" = paste0("?? x ", length(unclass(x)))) |
| 26 |
} |
| 27 |
) |
| 28 |
} |