I need to convert a dataframe of floats with 2-decimal point precision to strings. However, as.character drops zeros in the decimal part:
> as.character(1.00)
We can use sprintf
sprintf
sprintf("%0.2f", 1.10) #[1] "1.10" sprintf("%0.2f", 1.00) #[1] "1.00"