R Show Numbers in Scientific Notation (e.g. 3e-5 (Example Code)

This post explains how to show numbers in scientific notation (e.g. 12e-7) in R programming.

Creating Example Data

my_number <- 11111.11111        # Example number in R
my_number                       # Default way of displaying number
# [1] 11111.11

Example: Convert Numeric Data to Scientific Notation Character String

formatC(my_number,              # Display number in scientific notation
        format = "e",
        digits = 1)
# [1] "1.1e+04"

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