Disable Scientific Notation in R (2 Examples)

This tutorial explains how to prevent the R programming language from using scientific notation (e.g. e+10).

Example Data

numeric_value <- 2873642387462              # Example number
numeric_value                               # Print example number
# 2.873642e+12

Example 1: Modify Global Options

You can modify the global options of your R installation to not show scientific notation anymore:

options(scipen = 999)                       # Modify global options

If we now print our example number, scientific notation is disabled.

numeric_value                               # Print example number
# 2873642387462

Example 2: Use format function to Disable Scientific Notation

Another alternative is the application of the format function:

format(numeric_value, scientific = FALSE)   # Apply format function
# "2873642387462"

Note that the format function converts our numeric number to a character string.

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top