Format number in R with both comma thousands separator and specified decimals
formatC(1000.64, format="f", big.mark=",", digits=1)
(sorry if i'm missing something.)
format
not formatC
:
format(round(as.numeric(1000.64), 1), nsmall=1, big.mark=",") # 1,000.6
formattable
provides comma
:
library(formattable)
comma(1000.64, digits = 1) # 1,000.6
comma
provides an elementary interface to formatC
.