Skip to content

fmt_currency(currency = "GBP") shows unusual behaviour with interactive tables #1443

@jack-davison

Description

@jack-davison

Prework

Description

Hi Rich and team,

The fmt_currency() function can append "£" to a static table, but when that table is transformed to an interactive table it is replaced with the literal characters "GBP", which looks bizarre.

I expect this isn't expected behaviour, as the dollar symbol ($) renders fine with, e.g., "AUS" and "CAN".

Reproducible example

library(gt)

tbl <- data.frame(cost = 100)

# currency markers work fine
gt(tbl) |>
  fmt_currency(currency = "GBP")

# until they're interactive...
gt(tbl) |>
  fmt_currency(currency = "GBP") |>
  opt_interactive()

Screenshot:

image

Expected result

The interactive table should look more like the static table, with the "£" sign.

image

Session info

library(gt)
sessionInfo()
#> R version 4.3.1 (2023-06-16 ucrt)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 11 x64 (build 22621)
#> 
#> Matrix products: default
#> 
#> 
#> locale:
#> [1] LC_COLLATE=English_United Kingdom.utf8 
#> [2] LC_CTYPE=English_United Kingdom.utf8   
#> [3] LC_MONETARY=English_United Kingdom.utf8
#> [4] LC_NUMERIC=C                           
#> [5] LC_TIME=English_United Kingdom.utf8    
#> 
#> time zone: Europe/London
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] gt_0.9.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] vctrs_0.6.2       cli_3.6.1         knitr_1.42        rlang_1.1.1      
#>  [5] xfun_0.39         purrr_1.0.1       styler_1.9.1      generics_0.1.3   
#>  [9] glue_1.6.2        htmltools_0.5.5   fansi_1.0.4       rmarkdown_2.21   
#> [13] R.cache_0.16.0    tibble_3.2.1      evaluate_0.21     fastmap_1.1.1    
#> [17] yaml_2.3.7        lifecycle_1.0.3   compiler_4.3.1    dplyr_1.1.2      
#> [21] fs_1.6.2          pkgconfig_2.0.3   rstudioapi_0.14   R.oo_1.25.0      
#> [25] R.utils_2.12.2    digest_0.6.31     R6_2.5.1          tidyselect_1.2.0 
#> [29] utf8_1.2.3        reprex_2.0.2      pillar_1.9.0      magrittr_2.0.3   
#> [33] R.methodsS3_1.8.2 tools_4.3.1       withr_2.5.0       xml2_1.3.4

Created on 2023-09-24 with reprex v2.0.2

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions