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

adding a theme to gt object inflates output html file size unreasonably #137

Open
salupere opened this issue Oct 8, 2024 · 0 comments
Open
Assignees

Comments

@salupere
Copy link

salupere commented Oct 8, 2024

Description

When using gt_theme function inside quarto/rmardown html knitted document, adding theme to each table increases final html file size about 7 megabytes. Without theme the below example woul be around 1 MB, theme adds 7MB. Therefore longer reports (with tens of tables) would be rendered unportable.

Reproducible example

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(gt)
library(gtExtras)


tibble(
  Column1 = c(1, 2, 3, 4, 5),
  Column2 = c('A', 'B', 'C', 'D', 'E'),
  Column3 = c(TRUE, FALSE, TRUE, FALSE, TRUE)) %>% 
gt() %>% 
gt_theme_nytimes()  

Created on 2024-10-08 with reprex v2.1.1

Session info
sessionInfo()
#> R version 4.4.1 (2024-06-14)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.1 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Europe/Tallinn
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.37     fastmap_1.2.0     xfun_0.47         glue_1.8.0       
#>  [5] knitr_1.48        htmltools_0.5.8.1 rmarkdown_2.28    lifecycle_1.0.4  
#>  [9] cli_3.6.3         reprex_2.1.1      withr_3.0.1       compiler_4.4.1   
#> [13] rstudioapi_0.16.0 tools_4.4.1       evaluate_1.0.0    yaml_2.3.10      
#> [17] rlang_1.1.4       fs_1.6.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants