Exponential Numbers

[This article was first published on Daniel MarcelinoDaniel Marcelino » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

scientific-notation-1 I received a message asking me why I use so often numbers like 1e6 (exponential form) instead of writing down the whole numbers. I never thought on this before. However, I can assure that it’s not because I’m lazy and don’t like typing long numbers. In fact, thinking on this made me find a reasonable explanation for this: With very large or very small numbers one can end up miscounting some zeros, hence we sometimes can avoid this by typing those numbers in exponential format. So 1e6 is 110^6=1,000,000 and 2.1e-4 is 5.110^-4=0.00051. In Stata one can figure out what the exponential number means by typing: display 1e6, whereas in R it is enough to type: format(1e6, scientific=F). Now, if you want R to display only scientific number instead, you want to set options as: options(scipen = -10).

To leave a comment for the author, please follow the link and comment on their blog: Daniel MarcelinoDaniel Marcelino » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)