gt
gt copied to clipboard
`fmt_markdown()` doesnt affect group cols
fmt_markdown()
does not affect group cols when attempting to format with markdown.
library(gt)
suppressMessages(library(dplyr))
gtcars |>
mutate(group_col = paste0("<b>", ctry_origin, ' ', mfr, "</b>"),
mfr = paste0("<b>",mfr,"</b>")) |>
head(10) |>
gt(groupname_col = "group_col",
row_group_as_column = T) |>
fmt_markdown(columns = "group_col") |>
fmt_markdown(columns = "mfr")
mfr | model | year | trim | bdy_style | hp | hp_rpm | trq | trq_rpm | mpg_c | mpg_h | drivetrain | trsmn | ctry_origin | msrp | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<b>United States Ford</b> | Ford |
GT | 2017 | Base Coupe | coupe | 647 | 6250 | 550 | 5900 | 11 | 18 | rwd | 7a | United States | 447000 |
<b>Italy Ferrari</b> | Ferrari |
458 Speciale | 2015 | Base Coupe | coupe | 597 | 9000 | 398 | 6000 | 13 | 17 | rwd | 7a | Italy | 291744 |
Ferrari |
458 Spider | 2015 | Base | convertible | 562 | 9000 | 398 | 6000 | 13 | 17 | rwd | 7a | Italy | 263553 | |
Ferrari |
458 Italia | 2014 | Base Coupe | coupe | 562 | 9000 | 398 | 6000 | 13 | 17 | rwd | 7a | Italy | 233509 | |
Ferrari |
488 GTB | 2016 | Base Coupe | coupe | 661 | 8000 | 561 | 3000 | 15 | 22 | rwd | 7a | Italy | 245400 | |
Ferrari |
California | 2015 | Base Convertible | convertible | 553 | 7500 | 557 | 4750 | 16 | 23 | rwd | 7a | Italy | 198973 | |
Ferrari |
GTC4Lusso | 2017 | Base Coupe | coupe | 680 | 8250 | 514 | 5750 | 12 | 17 | awd | 7a | Italy | 298000 | |
Ferrari |
FF | 2015 | Base Coupe | coupe | 652 | 8000 | 504 | 6000 | 11 | 16 | awd | 7a | Italy | 295000 | |
Ferrari |
F12Berlinetta | 2015 | Base Coupe | coupe | 731 | 8250 | 509 | 6000 | 11 | 16 | rwd | 7a | Italy | 319995 | |
Ferrari |
LaFerrari | 2015 | Base Coupe | coupe | 949 | 9000 | 664 | 6750 | 12 | 16 | rwd | 7a | Italy | 1416362 |
sessionInfo()
#> R version 4.3.2 (2023-10-31)
#> Platform: aarch64-apple-darwin20 (64-bit)
#> Running under: macOS Sonoma 14.2.1
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> time zone: America/Chicago
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] dplyr_1.1.4 gt_0.10.1
#>
#> loaded via a namespace (and not attached):
#> [1] vctrs_0.6.5 cli_3.6.2 knitr_1.45 rlang_1.1.2
#> [5] xfun_0.41 generics_0.1.3 glue_1.7.0 markdown_1.12
#> [9] htmltools_0.5.7 sass_0.4.8 fansi_1.0.6 rmarkdown_2.25
#> [13] evaluate_0.23 tibble_3.2.1 fastmap_1.1.1 yaml_2.3.8
#> [17] lifecycle_1.0.4 compiler_4.3.2 fs_1.6.3 pkgconfig_2.0.3
#> [21] rstudioapi_0.15.0 digest_0.6.33 R6_2.5.1 reprex_2.0.2
#> [25] tidyselect_1.2.0 utf8_1.2.4 pillar_1.9.0 commonmark_1.9.1
#> [29] magrittr_2.0.3 tools_4.3.2 withr_2.5.2 xml2_1.3.6
Created on 2024-02-14 with reprex v2.0.2