Home > OS >  Rounding off to decimals
Rounding off to decimals

Time:06-12

I have worked out a probability in r (equal to 1.7715e-06) and I would like to be able to view it to 10 decimal points. Does anybody know how to convert this to 10 decimal points? I've tried using the round() and signific() functions but they aren't useful.

I got this answer (1.7715e-06) using:

dbinom(11, 11, 0.3)

CodePudding user response:

A possible solution:

format(round(dbinom(11, 11, 0.3), 10), scientific = F)

#> [1] "0.0000017715"

CodePudding user response:

You can also do this:

options("scipen"=999)

Then:

.3^11
[1] 0.00000177147

or

round(.3^11,10)
[1] 0.0000017715

or

dbinom(11,11,.3)
[1] 0.00000177147

or

round(dbinom(11,11,.3),10)
[1] 0.0000017715
  • Related