A number such as 0.0000123 can appear as 1.23e-05 when R prints it. If that makes a table or report harder to read, display the number without scientific notation in R: use options(scipen = 999) for a broad session preference, format() for a particular output, or sprintf() for a fixed number of decimal places.
The number itself has not changed. Scientific notation in R is a compact way to write a value: 1.23e-05 means 1.23 multiplied by 10 to the power of โ5. Before choosing a formatting method, decide whether the result must remain numeric for further calculations or become text for display.
R Scientific Notation and the Stored Value
Run this small example in a fresh R session:
x <- 0.0000123
x
x * 100000
R may print x as 1.23e-05; multiplying it by 100,000 gives 1.23. Writing the same input as 1.23e-5 creates the same numeric value. Both forms describe a number; neither form is a different unit or a different calculation. If you want to remove scientific notation from R output, choose the display method according to where the number will be used. In R, no scientific notation is needed to enter this example: both spellings create the same value. The R scientific notation convention uses e to separate the coefficient from the exponent.
The distinction matters when you suppress scientific notation in R. A display choice determines the characters a reader sees. It does not recover digits that were never present in the input, nor does it make floating-point arithmetic exact. Keep the original numeric object for calculations and create display text only at the point where you need it.
Change the preference for a session with scipen
old_options <- options(scipen = 999)
x <- 0.0000123
x
options(old_options)
The first line sets scipen and saves the previous setting. The final line restores it. A positive scipen applies a penalty to scientific notation when R chooses how to print numbers, making fixed notation more likely. With the value above, this example will normally display as 0.0000123.
Use this approach when you want many ordinary numeric printouts to favor a non-scientific display during an interactive session. Raising scipen discourages R from printing scientific notation for those values. The setting affects subsequent output that consults the option, not just x. Restore the previous value when the preference is no longer wanted, particularly in a shared script or function. You can inspect it with getOption("scipen").
The setting is a preference, not an absolute ban on exponent notation. R compares the widths of the representations, so a sufficiently long fixed form can still lose. Some packages and output functions also use their own formatting rules. For one specific label or report cell, choose an explicit formatter instead of relying on a session setting. That way, the code producing the output specifies that R should not use scientific notation for that result.
Format one result without changing the session
x <- 0.0000123
label <- format(x, scientific = FALSE, trim = TRUE)
label
class(label)
The label is "0.0000123", and its class is "character". In R, no scientific notation appears in this label because the call explicitly requests fixed formatting. scientific = FALSE requests fixed notation for this formatting call; trim = TRUE removes leading padding. To show values in R without scientific notation for a particular output, this keeps the choice close to the code that needs it.
format() can also process a vector. Its default formatting aims for a common presentation across elements, so decimal places and spacing may reflect the other values in that vector. trim removes leading spaces, but the displayed precision still deserves inspection. When you turn off scientific notation in R with format(), check how many digits remain visible in each result. For example, try formatting c(0.0000123, 1.2) and compare the two strings with the original numeric values.
Scientific notation in R can reappear if you print the original x instead of label: formatting returned a new character value; it did not alter x or the global preference. This separation is useful in reports, where the calculation and its presentation often need different rules.
Use sprintf for a fixed number of decimal places
x <- 12.3456
label <- sprintf("%.2f", x)
label
x
The label is "12.35". In R, no scientific notation appears in this label because %f specifies fixed-point output. In %.2f, f requests fixed-point notation and .2 requests two digits after the decimal point. The original x remains numeric and retains its stored value. Use this method for a column of dollar amounts or another output where each entry should have the same number of decimal places. This fixed-point format prevents scientific notation in the R output produced by the call.
A fixed number of decimal places can hide a small nonzero number. For example, sprintf("%.2f", 0.0000123) returns "0.00". That is rounded display text, not proof that the numeric value is zero. If the small values matter, choose more decimal places or use a different display rule. To avoid scientific notation in R for that example while keeping its visible digits, sprintf("%.7f", 0.0000123) produces "0.0000123".
Choose by scope and precision
In R, no scientific notation appears in the result of sprintf("%.7f", 0.0000123), which is a character string. To control R scientific notation across ordinary printouts, start by considering the scope of the change. For a session-wide preference, use scipen and restore the previous option. For a one-off representation without exponential notation in R, use format(..., scientific = FALSE). To replace scientific notation in an R label with a chosen number of decimal places, use sprintf() and select the count according to the meaning of the data. All three methods control presentation; the latter two return character strings.
Do arithmetic and numeric comparisons with the original values, not formatted labels. For example, x * 2 works on the number; a label with commas or other decoration is text and may not convert back cleanly. If you export formatted strings, the receiving program may treat them as text too. Decide whether readers need a display-ready report or a numeric dataset they can calculate with, and inspect the exported file accordingly.
When the output still looks wrong
The most common surprise is a value that looks like zero after formatting or still appears with an exponent elsewhere. First compare x with its label and run class(x) and class(label). If the label is rounded too aggressively, increase the decimal places or choose a format appropriate to the scale. If the original still uses scientific notation, check whether you printed the original instead of the formatted result, inspect getOption("scipen"), and check whether the particular output tool uses its own display rules.
