How to turn off scientific notation in R?

In R, scientific notation can be turned off by using the options() function and setting the option “scipen” to a value greater than 0. This will tell R to stop using scientific notation for values with more than the specified number of digits. This can be helpful when working with large numbers or when wanting to see the exact value of a number instead of a rounded value.


You can use the following methods to turn off scientific notation in R;

Method 1: Turn off scientific notation as global setting

options(scipen=999)

Method 2: Turn off scientific notation for one variable

format(x, scientific = F)

The following examples show how to use each of these methods in practice.

Method 1: Turn Off Scientific Notation as Global Setting

Suppose we perform the following multiplication in R:

#perform multiplication
x <- 9999999 * 12345

#view results
x

[1] 1.2345e+11

The output is shown in scientific notation since the number is so large.

The following code shows how to turn off scientific notation as a global setting. This means no variable in any output will be shown in scientific notation.

#turn off scientific notation for all variables
options(scipen=999) 

#perform multiplication
x <- 9999999 * 12345

#view results
x

[1] 123449987655

Notice that the entire number is displayed since we turned off scientific notation.

Note that the default value for scipen is 0 so you can reset this global setting by using options(scipen=0) in R:

#turn scientific notation back on
options(scipen=0) 

#perform multiplication again
x <- 9999999 * 12345

#view results
x

[1] 1.2345e+11

Method 2: Turn Off Scientific Notation for One Variable

The following code shows how to turn off scientific notation for just one variable:

#perform multiplication
x <- 9999999 * 12345

#display results and turn of scientific notation
format(x, scientific = F)

[1] "123449987655"

#perform another multiplication
y <- 9999999 * 999999

#view results
y

[1] 9.999989e+12

Notice that only the first variable is shown without scientific notation since it’s the only variable that we used the format() function on.

The following tutorials show how to perform other common operations in R:

x