Is there a way to prevent as.character
from using exponential notation? For example, I have
num <- c(9999999, 10000000)
char <- as.character(num)
char
[1] "9999999" "1e+07"
But instead I would like to have char
be "9999999" "10000000"
. Thanks!
format
is the function that lets you choose how you want your numbers formatted when converting to character. In this case, something like
format(c(9999999, 10000000), scientific = FALSE, trim = TRUE)
#> [1] "9999999" "10000000"
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