Intercept the final abbreviated tibble printout (with column shortening)

Open
#784 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
r
Domain
tooling

Research direction

Start by tracing the pillar codebase from the final abbreviated tibble printout and the column-shortening path. Determine whether an existing entry point exposes the final rendered column widths before rendering, then document or test the result using the shown custom-header and dashed-row scenario.

Written by the indexing model from the issue text.

Description

Hello, @zhanchen is trying to add a middle dashed row (but this above problem arises also in a custom header we want to do) in https://github.com/tidyomics/tidyprint

se_airway %>% print(design = "tidyprint_1")
#> # A SummarizedExperiment-tibble abstraction:
#> # Features=38694 | Samples=8 | Assays=counts
#>        .features       .samples   | counts | | dex     celltype geo_id    
#>        <chr>           <chr>      | <chr>  | | <chr>   <chr>    <chr>     
#> 1      ENSG00000000003 SRR1039508 | 723    | | control N61311   GSM1275862
#> 2      ENSG00000000005 SRR1039508 | 0      | | control N61311   GSM1275862
#> 3      ENSG00000000419 SRR1039508 | 467    | | control N61311   GSM1275862
#> 4      ENSG00000000457 SRR1039508 | 347    | | control N61311   GSM1275862
#> 5      ENSG00000000460 SRR1039508 | 96     | | control N61311   GSM1275862
#>        ---------       --------   - ------ - - ---     -------- ------    
#> 309548 ENSG00000283115 SRR1039521 | 0      | | treated N061011  GSM1275875
#> 309549 ENSG00000283116 SRR1039521 | 0      | | treated N061011  GSM1275875
#> 309550 ENSG00000283119 SRR1039521 | 0      | | treated N061011  GSM1275875
#> 309551 ENSG00000283120 SRR1039521 | 0      | | treated N061011  GSM1275875
#> 309552 ENSG00000283123 SRR1039521 | 0      | | treated N061011  GSM1275875

The problem is that we cannot predict how wide a column is, as pillar will shorten the columns depending on the context. With which function can we access the columns nchar of the final rendered table, before it is rendered?

We have looked at the pillar codebase, but it is not clear to us

Tagging

Thanks.

Dominant language
R
Stars
182
Forks
42
Avg merge
11h 50m
Merged PRs (30d)
7

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/pillar

All issues in r-lib/pillar

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.