You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Search for duplicates among the existing issues (both open and closed).
Proposal
fmt_currency() uses the default currency = "USD". Allow the user to set a different default. Maybe something simple like currency = getOption("gt.currency", default = "USD"). When the user doesn't set gt.currency, the default currency is USD.
The text was updated successfully, but these errors were encountered:
I admit that the current implementation is not what I wanted so I'm quite glad you made the issue for this! I don't really prefer using options (I know there are a few, but I hope they are for non-essentials) because it tends to be bad for reproducibility. However, I do have an idea for this.
We have the locale argument in the gt() function. By default, it's set to NULL but you could use "fr-BE" and, from that, we can obtain the territory's current currency. Here's an example:
exibble|>dplyr::select(num, currency) |>
gt(locale="fr-BE") |>
fmt_currency(
currency="EUR"# <- this line wouldn't be needed, `"EUR"` would be inferred from the `fr-BE` locale
)
This would involve making currency = NULL in fmt_currency() which is not bad at all. If locale is not specified in gt() or fmt_currency() then the default locale ("en") would be used, resulting in "USD" (same as before).
With these changes, you'd only need to specify the currency code to override the locale-provided currency. I know there are some strange cases where there are multiple currencies in current use, but that can be handled.
In addition to this, the info_locales() table should be updated to indicate which territory belongs to a base locale (e.g., "pt" -> "BR", "fr" -> "FR", etc.). Furthermore, the info_currencies() table should have information on the locales associated with each currency code.
Prework
Proposal
fmt_currency()
uses the defaultcurrency = "USD"
. Allow the user to set a different default. Maybe something simple likecurrency = getOption("gt.currency", default = "USD")
. When the user doesn't setgt.currency
, the default currency is USD.The text was updated successfully, but these errors were encountered: