Tests whether each element is a currency amount — a numeric value carrying
a currency symbol ($, €, £, ¥) as a prefix or suffix, with optional
sign, grouping separators, decimals and interior spaces: "$-45",
"$2300.00", "17,298$", "2300,00€", "€ 17.298", "-45€", "$1,000".
Value
A logical vector: TRUE for a symbol-bearing numeric amount, FALSE
otherwise, NA where x is NA.
Details
The symbol is required. A bare number ("1234", "-45.10") is deliberately
not a currency amount at the value level — it is indistinguishable from a
count or any other quantity (that is the symbol-less balance case, which is
metadata-gated). Requiring the symbol is what makes the detector selective.
See also
is_currency_symbol(), is_currency_code(), guess_data_type()
Other currency detectors:
is_currency_code(),
is_currency_code_symbol(),
is_currency_symbol()
Examples
is_currency_amount(c("$2300.00", "17,298$", "-45€", "1234", NA))
#> [1] TRUE TRUE TRUE FALSE NA
#> TRUE TRUE TRUE FALSE NA