rstudio/gt

`cols_nanoplot()` rendering bug, when setting `options(OutDec = ",")`

Open

#2053 opened on Oct 15, 2025

View on GitHub
 (0 comments) (0 reactions) (1 assignee)R (2,146 stars) (222 forks)batch import
Difficulty: [2] IntermediateEffort: [2] MediumFocus: HTML OutputFocus: i18nGood First IssuePriority: [3] HighType: ☹︎ Bug

Description

Description

Setting options(OutDec = ",") will interfere with the rendering of nanoplots in gt. (Javascript bug?)

This is just about the compatibility with other functions/packages, which use OutDec. Setting the gt.locale works as intended (options(gt.locale = "de")). scales is not impacted, since it uses scales::number_options()

Countries with comma as decimal seperator: https://en.wikipedia.org/wiki/Decimal_separator#Countries_using_decimal_comma

Reproducible example

library(gt)

options(OutDec = ",")

illness |>
  dplyr::slice_head(n = 10) |>
  gt(rowname_col = "test") |>
  cols_nanoplot(
    columns = starts_with("day"),
    new_col_name = "nanoplots",
    new_col_label = md("*Progression*")
  )

Results in:

Expected result

Session info

R version 4.4.2 (2024-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=German_Germany.utf8  LC_CTYPE=German_Germany.utf8    LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C                    LC_TIME=German_Germany.utf8    

time zone: Europe/Berlin
tzcode source: internal

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

other attached packages:
[1] gt_1.1.0

loaded via a namespace (and not attached):
 [1] digest_0.6.37     R6_2.6.1          fastmap_1.2.0     xfun_0.52         tidyselect_1.2.1  magrittr_2.0.4    glue_1.8.0        tibble_3.3.0      htmltools_0.5.8.1 pkgconfig_2.0.3  
[11] dplyr_1.1.4       generics_0.1.4    lifecycle_1.0.4   xml2_1.4.0        cli_3.6.5         litedown_0.7      sass_0.4.10       vctrs_0.6.5       withr_3.0.2       renv_1.1.4       
[21] compiler_4.4.2    tools_4.4.2       commonmark_2.0.0  pillar_1.11.1     yaml_2.3.10       fs_1.6.6          rlang_1.1.6       markdown_2.

Contributor guide