Skip to content
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

Make print.epi_df header mirror style of print.tsibble and print.tbl_df #113

Open
brookslogan opened this issue Jun 20, 2022 · 5 comments
Open
Assignees
Labels
P3 very low priority REPL Improved print, errors, etc.

Comments

@brookslogan
Copy link
Contributor

Currently, print.epi_df's "header" looks like

An `epi_df` object, with metadata:
* geo_type  = state
* time_type = day
* as_of     = 2020-06-03

# A tibble: 9 × 4

(from `ex1 from #103) or

An `epi_df` object, with metadata:
* geo_type  = state
* time_type = day
* as_of     = 2022-05-23 13:17:07

# A tibble: 4,026 × 6

(from jhu_csse_daily_subset).

In editors that color the # line, it makes it easy to overlook the epi_df part of this and think it's just a tibble.

Edit this header to be something more like

# An `epi_df` object: <nrow> x <ncol>, with metadata:
# * geo_type  = state
# * time_type = day
# * as_of     = 2020-06-03

which improves the user experience if they have that #-line-coloring editor behavior, and to match the style of tibble and tsibble printing.

@brookslogan brookslogan added P3 very low priority REPL Improved print, errors, etc. labels Jun 20, 2022
@brookslogan
Copy link
Contributor Author

brookslogan commented Jun 20, 2022

Additionally, we should print additional_metadata, or at least other_keys. Moved to #186

@brookslogan brookslogan added the good first issue Good for newcomers label Jun 21, 2022
@kenmawer kenmawer self-assigned this Jun 24, 2022
@kenmawer kenmawer closed this as completed Jul 8, 2022
Issue tracking for epipredict and epiprocess automation moved this from Backlog to Done Jul 8, 2022
@brookslogan brookslogan reopened this Jul 10, 2022
Issue tracking for epipredict and epiprocess automation moved this from Done to In Progress Jul 10, 2022
@brookslogan
Copy link
Contributor Author

Reopening this, as the current main only has part of the changes; current main print looks something like:

An `epi_df` object, 4,026 x 6 with metadata:
* geo_type  = state
* time_type = day
* as_of     = 2022-05-23 13:17:07

# A tibble: 4,026 × 6
[rest of tibble output]

which would look better as something like

# An `epi_df` object, 4,026 x 6 with metadata:
# * geo_type  = state
# * time_type = day
# * as_of     = 2022-05-23 13:17:07
[rest of tibble output]

or

# An `epi_df` object, 4,026 x 6 with metadata:
# * geo_type  = state
# * time_type = day
# * as_of     = 2022-05-23 13:17:07

[rest of tibble output]

especially when using an editor that colors the "comment" lines (approximated above by using perl as the "language" of the code blocks to trigger coloring of the comment lines and not a bunch of coloring of the other lines). Currently, one's eyes could be drawn to these "comment" lines and users may read too quickly and think that an epi_df they are printing is just a tibble.

Still just a P3, so it shouldn't take precedence over any the epipredict work (P0).

@brookslogan
Copy link
Contributor Author

brookslogan commented Aug 4, 2022

Additionally, it looks like print on current main may still not be printing the other_keys metadata. Moved to #186

@brookslogan
Copy link
Contributor Author

Based on discussion in #183, I'm opening another issue about the other_keys printing, and removing it from this one.

@brookslogan
Copy link
Contributor Author

brookslogan commented Apr 13, 2023

Think we might need to provide a tbl_format_header and/or tbl_sum method for this (generics are in the pillar package). [And check for interop with grouping. Problematic as grouped_df expects to be in front of the "base"-ish class in the class vector so it can tack stuff onto NextMethod(), but we currently put the "base"-ish class epi_df in front of grouped_df. That swap might be fine now, but might potentially cause issues for some other dplyr verbs, especially if we pursue #295; we'll need to check.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 very low priority REPL Improved print, errors, etc.
Development

No branches or pull requests

2 participants