R/string.R
decimal_dot.Rd
Sometimes it is necessary to use the dot character as the decimal separator.
In R, this could be affected by two settings: the global option
options(OutDec)
and the LC_NUMERIC
locale. This function sets the former
to .
and the latter to C
before evaluating an expression, such as
coercing a number to character.
decimal_dot(x)
The value of x
.
opts = options(OutDec = ",")
as.character(1.234) # using ',' as the decimal separator
#> [1] "1,234"
print(1.234) # same
#> [1] 1,234
xfun::decimal_dot(as.character(1.234)) # using dot
#> [1] "1.234"
xfun::decimal_dot(print(1.234)) # using dot
#> [1] 1.234
options(opts)