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

Show list of abbreviated columns #483

Merged
merged 11 commits into from
Apr 23, 2022
Merged

Show list of abbreviated columns #483

merged 11 commits into from
Apr 23, 2022

Conversation

krlmlr
Copy link
Member

@krlmlr krlmlr commented Jan 30, 2022

in footer.

The goal is to make all column names copy-pasteable and also get rid of options(pillar.min_title_chars = ) .

palmerpenguins::penguins
#> # A tibble: 344 × 8
#>    species island    bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
#>    <fct>   <fct>              <dbl>         <dbl>             <int>       <int>
#>  1 Adelie  Torgersen           39.1          18.7               181        3750
#>  2 Adelie  Torgersen           39.5          17.4               186        3800
#>  3 Adelie  Torgersen           40.3          18                 195        3250
#>  4 Adelie  Torgersen           NA            NA                  NA          NA
#>  5 Adelie  Torgersen           36.7          19.3               193        3450
#>  6 Adelie  Torgersen           39.3          20.6               190        3650
#>  7 Adelie  Torgersen           38.9          17.8               181        3625
#>  8 Adelie  Torgersen           39.2          19.6               195        4675
#>  9 Adelie  Torgersen           34.1          18.1               193        3475
#> 10 Adelie  Torgersen           42            20.2               190        4250
#> # … with 334 more rows, and 2 more variables: sex <fct>, year <int>

options(pillar.min_title_chars = 5)
palmerpenguins::penguins
#> # A tibble: 344 × 8
#>    species island    bill_length_mm bill_depth_mm flipper_le… body_… sex    year
#>    <fct>   <fct>              <dbl>         <dbl>       <int>  <int> <fct> <int>
#>  1 Adelie  Torgersen           39.1          18.7         181   3750 male   2007
#>  2 Adelie  Torgersen           39.5          17.4         186   3800 fema…  2007
#>  3 Adelie  Torgersen           40.3          18           195   3250 fema…  2007
#>  4 Adelie  Torgersen           NA            NA            NA     NA <NA>   2007
#>  5 Adelie  Torgersen           36.7          19.3         193   3450 fema…  2007
#>  6 Adelie  Torgersen           39.3          20.6         190   3650 male   2007
#>  7 Adelie  Torgersen           38.9          17.8         181   3625 fema…  2007
#>  8 Adelie  Torgersen           39.2          19.6         195   4675 male   2007
#>  9 Adelie  Torgersen           34.1          18.1         193   3475 <NA>   2007
#> 10 Adelie  Torgersen           42            20.2         190   4250 <NA>   2007
#> # … with 334 more rows, and abbreviated variable names flipper_length_mm,
#> #   body_mass_g

Created on 2022-01-30 by the reprex package (v2.0.1)

The display is not perfect, we want to show all the data in the sex column. I have some ideas:

  • let the data part decide how wide a column should be
  • new pillar.max_title_chars option

Do we want to switch to bullet points in the footer?

@krlmlr krlmlr changed the title Show abbreviated columns Show list of abbreviated columns Jan 30, 2022
@krlmlr krlmlr requested a review from hadley January 30, 2022 05:35
@krlmlr
Copy link
Member Author

krlmlr commented Feb 7, 2022

Footnotes.

@hadley
Copy link
Member

hadley commented Feb 25, 2022

This looks good to me assuming that we add some way to easily map from abbreviated column name to full name (i.e. not just relying on relative position.

@hadley
Copy link
Member

hadley commented Feb 25, 2022

Another idea would be to make sure you include enough characters so that if you typed them then autocomplete would pick the right variable. But that's probably too clever and hard to implement.

@krlmlr krlmlr force-pushed the f-abbrev-columns branch from 6f6e276 to c066566 Compare April 22, 2022 17:43
@krlmlr
Copy link
Member Author

krlmlr commented Apr 22, 2022

@hadley: Now with footnotes (up to 9, a "superscript asterisk" is shown after that, https://twitter.com/krlmlr/status/1517535874887651329).

palmerpenguins::penguins
#> # A tibble: 344 × 8
#>    species island    bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
#>    <fct>   <fct>              <dbl>         <dbl>             <int>       <int>
#>  1 Adelie  Torgersen           39.1          18.7               181        3750
#>  2 Adelie  Torgersen           39.5          17.4               186        3800
#>  3 Adelie  Torgersen           40.3          18                 195        3250
#>  4 Adelie  Torgersen           NA            NA                  NA          NA
#>  5 Adelie  Torgersen           36.7          19.3               193        3450
#>  6 Adelie  Torgersen           39.3          20.6               190        3650
#>  7 Adelie  Torgersen           38.9          17.8               181        3625
#>  8 Adelie  Torgersen           39.2          19.6               195        4675
#>  9 Adelie  Torgersen           34.1          18.1               193        3475
#> 10 Adelie  Torgersen           42            20.2               190        4250
#> # … with 334 more rows, and 2 more variables: sex <fct>, year <int>
options(pillar.min_title_chars = 5)
palmerpenguins::penguins
#> # A tibble: 344 × 8
#>    species island    bill_length_mm bill_depth_mm flipper_l…¹ body…² sex    year
#>    <fct>   <fct>              <dbl>         <dbl>       <int>  <int> <fct> <int>
#>  1 Adelie  Torgersen           39.1          18.7         181   3750 male   2007
#>  2 Adelie  Torgersen           39.5          17.4         186   3800 fema…  2007
#>  3 Adelie  Torgersen           40.3          18           195   3250 fema…  2007
#>  4 Adelie  Torgersen           NA            NA            NA     NA <NA>   2007
#>  5 Adelie  Torgersen           36.7          19.3         193   3450 fema…  2007
#>  6 Adelie  Torgersen           39.3          20.6         190   3650 male   2007
#>  7 Adelie  Torgersen           38.9          17.8         181   3625 fema…  2007
#>  8 Adelie  Torgersen           39.2          19.6         195   4675 male   2007
#>  9 Adelie  Torgersen           34.1          18.1         193   3475 <NA>   2007
#> 10 Adelie  Torgersen           42            20.2         190   4250 <NA>   2007
#> # … with 334 more rows, and abbreviated variable names ¹flipper_length_mm,
#> #   ²body_mass_g

Created on 2022-04-22 by the reprex package (v2.0.1)

@krlmlr
Copy link
Member Author

krlmlr commented Apr 22, 2022

I'll add an extra space after the footnote in the footer though, because otherwise we still can't select the abbreviated column name (the footnote is always selected).

@krlmlr krlmlr merged commit d1159b6 into main Apr 23, 2022
@krlmlr krlmlr deleted the f-abbrev-columns branch April 23, 2022 08:18
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants