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

Truncate additional variables after fixed number of lines #263

Closed
hadley opened this issue Feb 27, 2021 · 6 comments · Fixed by #354
Closed

Truncate additional variables after fixed number of lines #263

hadley opened this issue Feb 27, 2021 · 6 comments · Fixed by #354
Assignees
Milestone

Comments

@hadley
Copy link
Member

hadley commented Feb 27, 2021

Motivating example is data frames returned by tweetr:

# A tibble: 3 x 91
  user_id  status_id  created_at          screen_name text         source  display_text_wi…
  <chr>    <chr>      <dttm>              <chr>       <chr>        <chr>              <dbl>
1 14465607 567053242… 2015-02-15 20:10:02 AHMalcolm   For every r… Twuffer              127
2 813286   266031293… 2012-11-07 04:16:18 BarackObama Four more y… Twitte…               37
3 15846407 440322224… 2014-03-03 03:06:13 TheEllenSh… If only Bra… Twitte…               81
# … with 84 more variables: reply_to_status_id <lgl>, reply_to_user_id <lgl>,
#   reply_to_screen_name <lgl>, is_quote <lgl>, is_retweet <lgl>, favorite_count <int>,
#   retweet_count <int>, quote_count <int>, reply_count <int>, hashtags <list>,
#   symbols <list>, urls_url <list>, urls_t.co <list>, urls_expanded_url <list>,
#   media_url <list>, media_t.co <list>, media_expanded_url <list>, media_type <list>,
#   ext_media_url <list>, ext_media_t.co <list>, ext_media_expanded_url <list>,
#   ext_media_type <chr>, ext_alt_text <list>, mentions_user_id <list>,
#   mentions_screen_name <list>, lang <chr>, quoted_status_id <chr>, quoted_text <chr>,
#   quoted_created_at <dttm>, quoted_source <chr>, quoted_favorite_count <int>,
#   quoted_retweet_count <int>, quoted_user_id <chr>, quoted_screen_name <chr>,
#   quoted_name <chr>, quoted_followers_count <int>, quoted_friends_count <int>,
#   quoted_statuses_count <int>, quoted_location <chr>, quoted_description <chr>,
#   quoted_verified <lgl>, retweet_status_id <chr>, retweet_text <chr>,
#   retweet_created_at <dttm>, retweet_source <chr>, retweet_favorite_count <int>,
#   retweet_retweet_count <int>, retweet_user_id <chr>, retweet_screen_name <chr>,
#   retweet_name <chr>, retweet_followers_count <int>, retweet_friends_count <int>,
#   retweet_statuses_count <int>, retweet_location <chr>, retweet_description <chr>,
#   retweet_verified <lgl>, place_url <chr>, place_name <chr>, place_full_name <chr>,
#   place_type <chr>, country <chr>, country_code <chr>, geo_coords <list>,
#   coords_coords <list>, bbox_coords <list>, status_url <chr>, name <chr>,
#   location <chr>, description <chr>, url <chr>, protected <lgl>, followers_count <int>,
#   friends_count <int>, listed_count <int>, statuses_count <int>, favourites_count <int>,
#   account_created_at <dttm>, verified <lgl>, profile_url <chr>,
#   profile_expanded_url <chr>, account_lang <lgl>, profile_banner_url <chr>,
#   profile_background_url <chr>, profile_image_url <chr>
@hadley
Copy link
Member Author

hadley commented Apr 5, 2021

I think it would be useful to have a pillar.variables_max_lines (or similar). The default would be maybe 5 lines, giving:

# A tibble: 3 x 91
  user_id  status_id  created_at          screen_name text         source  display_text_wi<chr>    <chr>      <dttm>              <chr>       <chr>        <chr>              <dbl>
1 14465607 5670532422015-02-15 20:10:02 AHMalcolm   For every rTwuffer              127
2 813286   2660312932012-11-07 04:16:18 BarackObama Four more yTwitte37
3 15846407 4403222242014-03-03 03:06:13 TheEllenShIf only BraTwitte81
# … with 84 more variables: reply_to_status_id <lgl>, reply_to_user_id <lgl>,
#   reply_to_screen_name <lgl>, is_quote <lgl>, is_retweet <lgl>, favorite_count <int>,
#   retweet_count <int>, quote_count <int>, reply_count <int>, hashtags <list>,
#   symbols <list>, urls_url <list>, urls_t.co <list>, urls_expanded_url <list>,
#   media_url <list>, media_t.co <list>, media_expanded_url <list>, media_type <list>, ...

OTOH it's possible that this should actually be resolved in rtweet, which I'm exploring in ropensci-archive/rtweet#558.

@krlmlr
Copy link
Member

krlmlr commented Apr 5, 2021

We should also resolve this here.

@krlmlr krlmlr added this to the 1.6.1 milestone Apr 11, 2021
@krlmlr krlmlr modified the milestones: 1.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9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182
)

data
#> # A tibble: 1 x 182
#>       A     B     C     D     E     F     G     H     I     J     K     L     M
#>   <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1     1     2     3     4     5     6     7     8     9    10    11    12    13
#> # … with 169 more variables: N <dbl>, O <dbl>, P <dbl>, Q <dbl>, R <dbl>,
#> #   S <dbl>, T <dbl>, U <dbl>, V <dbl>, W <dbl>, X <dbl>, Y <dbl>, Z <dbl>,
#> #   AA <dbl>, AB <dbl>, AC <dbl>, AD <dbl>, AE <dbl>, AF <dbl>, AG <dbl>,
#> #   AH <dbl>, AI <dbl>, AJ <dbl>, AK <dbl>, AL <dbl>, AM <dbl>, AN <dbl>,
#> #   AO <dbl>, AP <dbl>, AQ <dbl>, AR <dbl>, AS <dbl>, AT <dbl>, AU <dbl>,
#> #   AV <dbl>, AW <dbl>, AX <dbl>, AY <dbl>, AZ <dbl>, BA <dbl>, BB <dbl>,
#> #   BC <dbl>, BD <dbl>, BE <dbl>, BF <dbl>, BG <dbl>, BH <dbl>, BI <dbl>,
#> #   BJ <dbl>, BK <dbl>, BL <dbl>, BM <dbl>, BN <dbl>, BO <dbl>, BP <dbl>,
#> #   BQ <dbl>, BR <dbl>, BS <dbl>, BT <dbl>, BU <dbl>, BV <dbl>, BW <dbl>,
#> #   BX <dbl>, BY <dbl>, BZ <dbl>, CA <dbl>, CB <dbl>, CC <dbl>, CD <dbl>,
#> #   CE <dbl>, CF <dbl>, CG <dbl>, CH <dbl>, CI <dbl>, CJ <dbl>, CK <dbl>,
#> #   CL <dbl>, CM <dbl>, CN <dbl>, CO <dbl>, CP <dbl>, CQ <dbl>, CR <dbl>,
#> #   CS <dbl>, CT <dbl>, CU <dbl>, CV <dbl>, CW <dbl>, CX <dbl>, CY <dbl>,
#> #   CZ <dbl>, DA <dbl>, DB <dbl>, DC <dbl>, DD <dbl>, DE <dbl>, DF <dbl>,
#> #   DG <dbl>, DH <dbl>, DI <dbl>, …

Created on 2021-05-25 by the reprex package (v2.0.0)

@hadley
Copy link
Member Author

hadley commented Jun 2, 2021

An reprex with slightly longer variable names:

names <- outer(letters[1:2], letters, paste0)
x <- setNames(as.list(seq_along(names)), paste0("a_long_variable_name_", names))
tibble::as_tibble(x)
#> # A tibble: 1 x 52
#>   a_long_variable_na… a_long_variable_na… a_long_variable_na… a_long_variable_n…
#>                 <int>               <int>               <int>              <int>
#> 1                   1                   2                   3                  4
#> # … with 48 more variables: a_long_variable_name_ac <int>,
#> #   a_long_variable_name_bc <int>, a_long_variable_name_ad <int>,
#> #   a_long_variable_name_bd <int>, a_long_variable_name_ae <int>,
#> #   a_long_variable_name_be <int>, a_long_variable_name_af <int>,
#> #   a_long_variable_name_bf <int>, a_long_variable_name_ag <int>,
#> #   a_long_variable_name_bg <int>, a_long_variable_name_ah <int>,
#> #   a_long_variable_name_bh <int>, a_long_variable_name_ai <int>,
#> #   a_long_variable_name_bi <int>, a_long_variable_name_aj <int>,
#> #   a_long_variable_name_bj <int>, a_long_variable_name_ak <int>,
#> #   a_long_variable_name_bk <int>, a_long_variable_name_al <int>,
#> #   a_long_variable_name_bl <int>, a_long_variable_name_am <int>,
#> #   a_long_variable_name_bm <int>, a_long_variable_name_an <int>,
#> #   a_long_variable_name_bn <int>, a_long_variable_name_ao <int>,
#> #   a_long_variable_name_bo <int>, a_long_variable_name_ap <int>,
#> #   a_long_variable_name_bp <int>, a_long_variable_name_aq <int>,
#> #   a_long_variable_name_bq <int>, a_long_variable_name_ar <int>,
#> #   a_long_variable_name_br <int>, a_long_variable_name_as <int>,
#> #   a_long_variable_name_bs <int>, a_long_variable_name_at <int>,
#> #   a_long_variable_name_bt <int>, a_long_variable_name_au <int>,
#> #   a_long_variable_name_bu <int>, a_long_variable_name_av <int>,
#> #   a_long_variable_name_bv <int>, a_long_variable_name_aw <int>,
#> #   a_long_variable_name_bw <int>, a_long_variable_name_ax <int>,
#> #   a_long_variable_name_bx <int>, a_long_variable_name_ay <int>,
#> #   a_long_variable_name_by <int>, a_long_variable_name_az <int>,
#> #   a_long_variable_name_bz <int>

Created on 2021-06-02 by the reprex package (v2.0.0)

@krlmlr
Copy link
Member

krlmlr commented Jul 24, 2021

Waiting for #339.

krlmlr added a commit that referenced this issue Jul 27, 2021
- The new `pillar.max_footer_lines` option (default: 7) allows controlling the maximum number of footer lines shown. It is applied in addition to the existing `tibble.max_extra_cols` option (#263).
@github-actions
Copy link
Contributor

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2022
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 a pull request may close this issue.

2 participants