pillar
pillar copied to clipboard
Intercept the final abbreviated tibble printout (with column shortening)
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.