I have a numeric variable imported from Oracle with 17 numbers, for example: 20172334534654667.
Now I imported it from Oracle using dbGetQuery() in R, but R use scientific notation: 2.01723e+16
If I try to convert the number using:
mydata$var <- format(mydata$a, scientific=FALSE)
I obtain 20172334534654600 instead of 20172334534654667 So, the last two numbers are always substituted with 00.
How can I solve it, possibly without using additional packages?
I was unable to replicate your issue, but I think it would probably be best to use formatC rather than format.
For your case, it could be:
numb <- 20172334534654667
numb
formatC(numb, format = "f", digits = 0)
Which gives:
[1] "20172334534654668"
Hopefully that works for you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With