I am trying to convert from a string to a double in R. However, every time I convert the number, R creates an integer.
For example:
a = "100.11" a = as.double(a) And the output reads 100. How to I retain the decimals when converting from string to numeric? I've set options(digits=3).
Thanks
Mike
21 Answer
The problem is the option you have set:
options(digits=3) as.double("100.11") #[1] 100 options(digits=5) as.double("100.11") #[1] 100.11 digits "controls the number of digits to print when printing numeric values". You set the option to 3 and are shown 3 digits.