I was reading this SO post.
e.g. num <- 42
I want to print num as 42.0
. Not as "42.0"
(character).
I could use:
format(num, nsmall = 1)
But this still formats as a character string and if I try nesting in as.numeric I lose my decimal point.
How can I ensure num is a number with a single decimal point value?