Exponential Numbers

February 3, 2014
By

(This article was first published on Daniel MarcelinoDaniel Marcelino » R, and kindly contributed to R-bloggers)

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

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)