Skip to content

Commit

Permalink
Further down the rabbit hole
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisnic committed Apr 29, 2024
1 parent 5d0071c commit ac82e91
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions r/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ S3method(dim,StructArray)
S3method(dim,arrow_dplyr_query)
S3method(dimnames,ArrowTabular)
S3method(dimnames,Dataset)
S3method(format,ArrowTabular)
S3method(head,ArrowDatum)
S3method(head,ArrowTabular)
S3method(head,Dataset)
Expand Down
32 changes: 30 additions & 2 deletions r/R/arrow-tabular.R
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,34 @@ na.exclude.ArrowTabular <- na.omit.ArrowTabular

#' @export
print.ArrowTabular <- function(x, ..., n = NULL, width = NULL, n_extra = NULL){
cat(pillar:::format_tbl(x, width = NULL, ...,
cat(format(x, width = NULL, ...,
n_extra = NULL,
n = NULL, max_extra_cols = NULL, max_footer_lines = NULL))
n = NULL, max_extra_cols = NULL, max_footer_lines = NULL), fill = 2)
invisible(x)
}

# from pillar
#' @export
format.ArrowTabular <- function (x, width = NULL, ..., n_extra = NULL, n = NULL, max_extra_cols = NULL,
max_footer_lines = NULL){
check_dots_empty(action = signal)
if (!is.null(n_extra)) {
deprecate_stop("1.6.2", "pillar::format(n_extra = )",
"pillar::format(max_extra_cols = )")
if (is.null(max_extra_cols)) {
max_extra_cols <- n_extra
}
}
force(x)
setup <- tbl_format_setup(x, width = width, ..., n = n, max_extra_cols = max_extra_cols,
max_footer_lines = max_footer_lines, focus = attr(x,
"pillar_focus"))
header <- tbl_format_header(x, setup)
body <- tbl_format_body(x, setup)
footer <- tbl_format_footer(x, setup)
c(header, body, footer)
}

#' @importFrom pillar tbl_format_setup
#' @export
tbl_format_setup.ArrowTabular <- function(x, width, ..., n, max_extra_cols, max_footer_lines, focus){
Expand Down Expand Up @@ -304,3 +326,9 @@ tbl_format_footer.ArrowTabular <- function(x, setup, ...){
tbl_format_footer(tibble::tibble(), setup)
}

# from pillar
tbl_format_body <- function (x, setup, ...){
force(setup)
setup$body
}

0 comments on commit ac82e91

Please sign in to comment.