Reputation: 579
In Spain the format for numbers is for example: 4.000.000,25 (4 million and 1/4). Is there a way to change the format of numbers (preferably for the whole R project) without it being changed to characters?
Right now I preform a function on all my dataframes. Function looks like:
fnx = function(x){print(formatC(x, format = "d", big.mark = ".", decimal.mark = ","), quote=F)}
fnx(567*4325)
# 2.452.275
class(fnx(567*4325))
# "character"
Is there another way? And a way to not transform it to a character class?
Upvotes: 3
Views: 108
Reputation: 887108
We could use comma
from formattable
out <- formattable::comma(567*4325, big.mark = ".", decimal.mark = ",")
out
#[1] 2.452.275,00
-check the class
is.numeric(out)
#[1] TRUE
Upvotes: 5