# How to deactivate scientific notation of numbers in R?

We can use options(scipen=999) to do this.

## Example

> x <-c(253,254,36,874,351,651,245,274,19,1095)
> t.test(x,mu=2000)

One Sample t-test

data: x
t = -14.212, df = 9, p-value = 1.801e-07
alternative hypothesis: true mean is not equal to 2000

95 percent confidence interval −

151.3501 659.0499

sample estimates −

mean of x
405.2

Here p-value is in scientific notation. Now we can deactivate it as follows −

> options(scipen=999)
> t.test(x,mu=2000)

One Sample t-test

data: x
t = -14.212, df = 9, p-value = 0.0000001801
alternative hypothesis: true mean is not equal to 2000

95 percent confidence interval −

151.3501 659.0499

sample estimates −

mean of x
405.2

If we want to activate scientific notation again then it be done as shown below −

> options(scipen=0)
> t.test(x,mu=2000)

One Sample t-test

data: x
t = -14.212, df = 9, p-value = 1.801e-07
alternative hypothesis: true mean is not equal to 2000

95 percent confidence interval −

151.3501 659.0499

sample estimates −

mean of x
405.2

Updated on: 06-Jul-2020

370 Views

##### Kickstart Your Career

Get certified by completing the course