I have a data frame storing the dollar amount, it looks like this
> a cost 1 1e+05 2 2e+05
I would like it can be shown as this
A very simple way is
library(priceR) values <- c(1e5, 2e5) format_dollars(values) # [1] "$100,000" "$200,000"
format_dollars(values, 2)
"$100,000.00" "$200,000.00"
format_currency(values, "€")
"€100,000" "€200,000"