Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R round exponential number

Tags:

rounding

r

stat

I just trying to round in R number like:

> round(1.327076e-09)

I would like it to result in

> 1.33e-09

but results in

> 0

which function can use?

like image 722
stefan Avatar asked Apr 15 '11 10:04

stefan


People also ask

How do I get rid of E+ in R?

In order to eliminate the exponential notation of the integer, we can use the global setting using options() method, by setting the scipen argument, that is options(scipen = n).

How do I round to .5 in R?

Note that for rounding off a 5, the IEEE standard is used, ``go to the even digit''. Therefore round(0.5) is 0 and round(-1.5) is -2 . signif rounds the values in its first argument to the specified number of significant digits.


1 Answers

Try signif:

enter image description here

> signif(1.326135235e-09, digits = 3)
[1] 1.33e-09
like image 197
Roman Luštrik Avatar answered Sep 23 '22 12:09

Roman Luštrik