I have a number which show as
a <- 1.34467773e-5.
I want to format it to
a <- 1.34e-5.
How can I do it?
Thanks.
I have a number which show as
a <- 1.34467773e-5.
I want to format it to
a <- 1.34e-5.
How can I do it?
Thanks.
formatC(a, format = "e", digits = 2)
numeric
or character
, this is the latter. G5W's comment is the former. –
Cleavland You could also use the function sprintf
. For example:
sprintf("%.1e", 0.00008765)
© 2022 - 2024 — McMap. All rights reserved.
options(digits=3)
– Pusillanimity