r-lib/pillar

tibble `type` cells don't align `title` correctly.

Yunuuuu opened this issue · 7 comments

tibble column type cells don't align title correctly. Maybe a left align is better.
image

Here is my sessionInfo:

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936

attached base packages:
[1] stats     graphics  grDevices utils     datasets    
[6] methods   base

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7           here_1.0.1
 [3] fansi_0.5.0          crayon_1.4.2
 [5] RevoUtilsMath_11.0.0 utf8_1.2.2
 [7] rprojroot_2.0.2      cellranger_1.1.0
 [9] lifecycle_1.0.1      jsonlite_1.7.2
[11] magrittr_2.0.1       pillar_1.6.4
[13] cli_3.1.0            rlang_0.4.12
[15] readxl_1.3.1         vctrs_0.3.8
[17] ellipsis_0.3.2       tools_4.1.1
[19] compiler_4.1.1       pkgconfig_2.0.3
[21] tibble_3.1.6

Thanks. Could you please provide a reproducible example? Please see https://reprex.tidyverse.org/ for guidance.

Sorry. I'll add a little data to reproduce it.

examp_data <- readr::read_tsv(
    I("SampleID\tgroup19\tgroup191\ts__Parabacteroides_merdae\ts__unclassified_g__Alistipes\ts__Prevotella_sp._CAG:5226\ts__Alistipes_shahii\ts__Alistipes_sp._CAG:435\ts__Bacteroides_stercorirosoris\ts__Eubacterium_sp._CAG:841\ts__Alistipes_finegoldii\ts__Firmicutes_bacterium_CAG:341\ts__Clostridium_sp._CAG:492\ts__Faecalibacterium_prausnitzii\ts__unclassified_g__Faecalibacterium\ts__uncultured_Clostridium_sp.\ts__unclassified_g__Butyricicoccus\ts__Faecalibacterium_sp._AF10-46\ts__Sutterella_sp._AM11-39\r\nHC_15\tHC\t\t0.0036195574451\t0.000253337069757\t3.44424923774e-05\t0.00020676097156\t0\t0.000102727475301\t2.40933707605e-06\t0.000134640087278\t1.77489300644e-05\t7.11111075236e-07\t0.0403923916627\t0.00886017704569\t0.0033076240884\t0.000696970669206\t0.000616490323363\t9.84850981571e-06\r\nHC_18\tHC\t\t0.00373676677765\t0.00437086834404\t2.66726811975e-05\t0.00131019117256\t6.5784483081e-07\t5.82076942855e-05\t1.05781324384e-05\t0.00132022148637\t3.54595228636e-06\t1.83121878518e-06\t0.0427112051422\t0.027574372777\t0.00313472936022\t0.00066206894772\t0.000455211549015\t1.0584412812e-05")
)

examp_data 

here is the output:

image

It seems RStudio can give a pretty appearance. I'm using vscode with the raw r console (instead of radian).

the output of RStudio:
image

we can use the raw r terminal to reproduce this:

  1. run R.exe in a terminal (the R.exe path in windows or linux R command) (I don't know whether linux OS can give the issue)
  2. run following code:
examp_data <- readr::read_tsv(
    I("SampleID\tgroup19\tgroup191\ts__Parabacteroides_merdae\ts__unclassified_g__Alistipes\ts__Prevotella_sp._CAG:5226\ts__Alistipes_shahii\ts__Alistipes_sp._CAG:435\ts__Bacteroides_stercorirosoris\ts__Eubacterium_sp._CAG:841\ts__Alistipes_finegoldii\ts__Firmicutes_bacterium_CAG:341\ts__Clostridium_sp._CAG:492\ts__Faecalibacterium_prausnitzii\ts__unclassified_g__Faecalibacterium\ts__uncultured_Clostridium_sp.\ts__unclassified_g__Butyricicoccus\ts__Faecalibacterium_sp._AF10-46\ts__Sutterella_sp._AM11-39\r\nHC_15\tHC\t\t0.0036195574451\t0.000253337069757\t3.44424923774e-05\t0.00020676097156\t0\t0.000102727475301\t2.40933707605e-06\t0.000134640087278\t1.77489300644e-05\t7.11111075236e-07\t0.0403923916627\t0.00886017704569\t0.0033076240884\t0.000696970669206\t0.000616490323363\t9.84850981571e-06\r\nHC_18\tHC\t\t0.00373676677765\t0.00437086834404\t2.66726811975e-05\t0.00131019117256\t6.5784483081e-07\t5.82076942855e-05\t1.05781324384e-05\t0.00132022148637\t3.54595228636e-06\t1.83121878518e-06\t0.0427112051422\t0.027574372777\t0.00313472936022\t0.00066206894772\t0.000455211549015\t1.0584412812e-05")
)

examp_data 

Thanks. It looks good in RStudio, in a reprex (see below), and in a plain terminal. Can you perhaps try a different font? I'm not sure what we can do here to fix it.

examp_data <- readr::read_tsv(
  I("SampleID\tgroup19\tgroup191\ts__Parabacteroides_merdae\ts__unclassified_g__Alistipes\ts__Prevotella_sp._CAG:5226\ts__Alistipes_shahii\ts__Alistipes_sp._CAG:435\ts__Bacteroides_stercorirosoris\ts__Eubacterium_sp._CAG:841\ts__Alistipes_finegoldii\ts__Firmicutes_bacterium_CAG:341\ts__Clostridium_sp._CAG:492\ts__Faecalibacterium_prausnitzii\ts__unclassified_g__Faecalibacterium\ts__uncultured_Clostridium_sp.\ts__unclassified_g__Butyricicoccus\ts__Faecalibacterium_sp._AF10-46\ts__Sutterella_sp._AM11-39\r\nHC_15\tHC\t\t0.0036195574451\t0.000253337069757\t3.44424923774e-05\t0.00020676097156\t0\t0.000102727475301\t2.40933707605e-06\t0.000134640087278\t1.77489300644e-05\t7.11111075236e-07\t0.0403923916627\t0.00886017704569\t0.0033076240884\t0.000696970669206\t0.000616490323363\t9.84850981571e-06\r\nHC_18\tHC\t\t0.00373676677765\t0.00437086834404\t2.66726811975e-05\t0.00131019117256\t6.5784483081e-07\t5.82076942855e-05\t1.05781324384e-05\t0.00132022148637\t3.54595228636e-06\t1.83121878518e-06\t0.0427112051422\t0.027574372777\t0.00313472936022\t0.00066206894772\t0.000455211549015\t1.0584412812e-05")
)
#> Rows: 2 Columns: 19
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: "\t"
#> chr  (2): SampleID, group19
#> dbl (16): s__Parabacteroides_merdae, s__unclassified_g__Alistipes, s__Prevot...
#> lgl  (1): group191
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

examp_data
#> # A tibble: 2 × 19
#>   SampleID group19 group191 s__Parabacteroid… s__unclassified_… `s__Prevotella…`
#>   <chr>    <chr>   <lgl>                <dbl>             <dbl>            <dbl>
#> 1 HC_15    HC      NA                 0.00362          0.000253        0.0000344
#> 2 HC_18    HC      NA                 0.00374          0.00437         0.0000267
#> # … with 13 more variables: s__Alistipes_shahii <dbl>,
#> #   `s__Alistipes_sp._CAG:435` <dbl>, s__Bacteroides_stercorirosoris <dbl>,
#> #   `s__Eubacterium_sp._CAG:841` <dbl>, s__Alistipes_finegoldii <dbl>,
#> #   `s__Firmicutes_bacterium_CAG:341` <dbl>,
#> #   `s__Clostridium_sp._CAG:492` <dbl>, s__Faecalibacterium_prausnitzii <dbl>,
#> #   s__unclassified_g__Faecalibacterium <dbl>,
#> #   s__uncultured_Clostridium_sp. <dbl>, …

Created on 2021-12-29 by the reprex package (v2.0.1)

Thanks for your prompt reply, I have tried Lucida Console font which is used in my RStudio, but it remains here.
image

It seems this just occurs in vscode-the integrated terminal.

Thanks for your help, this may be specific to vscode.

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.