We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
fmt_markdown()
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")
Ford
Ferrari
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
The text was updated successfully, but these errors were encountered:
row_group_as_column = TRUE
A workaround for now is the following:
Basically, at render stage, the formats are not consulted when rendering row groups.
A workaround is to use process_md = TRUE in the gt() call:
process_md = TRUE
gt()
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", process_md = TRUE, row_group_as_column = T)
Since formats are rendered at the last stage, it may require a larger change.
gt/R/dt_stub_df.R
Lines 120 to 137 in 10711c5
Also, if you are looking to bold things, you may want to take a look at tab_options() / `tab_style().
tab_options()
The following should be more robust code:
gtcars |> mutate(group_col = paste(ctry_origin, mfr)) |> head(10) |> gt(groupname_col = "group_col", row_group_as_column = T) |> tab_style( cell_text(weight = "bold"), cells_body(columns = mfr) ) |> tab_options(row_group.font.westubight = "bold")
A more accurate title would be : formats don't affect group cols and row names (stub)
Sorry, something went wrong.
rich-iannone
No branches or pull requests
fmt_markdown()
does not affect group cols when attempting to format with markdown.Ford
Ferrari
Ferrari
Ferrari
Ferrari
Ferrari
Ferrari
Ferrari
Ferrari
Ferrari
Created on 2024-02-14 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: