-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Follow-up check in on #417 (more granular control over printing tibbles) #1016
Comments
Ok, digging in, it does appear to be tibble/R/tbl_sum.R that contributes the header:
After simply commenting out the single line (yielding an empty function, I suppose), the behavior seems to do what I want (with no clue on side effects):
Could someone with more knowledge chime in on a) if there are likely to be other widespread consequences to this and b) thoughts on toggling this inclusion via an additional option like |
Thanks for raising this, and thank you for your patience. This fell through the cracks. Custom printing can be achieved by overriding methods. Tibbles are of class There's a new article in https://tibble.tidyverse.org/dev/articles/extending.html (source: #1512) that has more details. I wonder what other documentation could be useful. Given the good customization options, I'd rather avoid adding new options that control the display. library(tibble)
tbl_format_header.tbl <- function(x, setup, ...) {
}
# Still shows header
tibble(a = 1)
#> # A tibble: 1 × 1
#> a
#> <dbl>
#> 1 1
tbl_format_header.tbl_df <- function(x, setup, ...) {
}
# Hides header
tibble(a = 1)
#> a
#> <dbl>
#> 1 1
# Safest option: custom subclass
my_tibble <- function(...) {
new_tibble(tibble(...), class = c("my_tbl_df", "tbl_df", "tbl"))
}
tbl_format_header.my_tbl_df <- function(x, setup, ...) {
}
my_tibble(a = 1)
#> a
#> <dbl>
#> 1 1 Created on 2023-02-22 with reprex v2.0.2 |
I love
dplyr
and use it from emacs/org-mode for including output in my results. I was looking into how to simply disable the text#A tibble: n x m
from every table. A meandering path led me through these various relevant bits of info:Since #417 is locked, I wanted to follow up as we are at ~4yrs since. For my input, my hope was to achieve simply turning off this persistent label of
#A tibble: n x m
. I'm okay with keeping variable types, and see there's already amax_footer_lines
option, which I think would still give me convenient control over including the total size of the tibble when it doesn't fit in the screen.At present, many of my tibbles are small and fit within the width of my document, which goes to "normal humans" who I don't want to distract with this constant labeling of unnecessary information. I still like the footer where the output doesn't fit, as it's nice to know "Oh, I'm not seeing everything because this is actually 300k lines long with 50 columns."
I'm not actually sure where this inserted header comes from, assuming I had the R chops to attempt a PR to add e.g. an
omit_header = T
option. I looked in bothtibble
andpillar
.Thanks for any updates on the likelihood of these more granular options as referenced in the article above, as well as for thoughts on the ease with which just that header could be removed (and doing so made to be an option as part of the print options).
P.S. Sorry if this should be in
pillar
... I'm putting it here because #417 is essentially the same and lives here. If you want, I'll copy/paste, link here, and close this.The text was updated successfully, but these errors were encountered: