How to turn off Scientific notation in R

Zaynaib Giwa
1 min readJul 17, 2023

--

If you are creating a chart with ggplot that has huge numbers it's a high chance that R will set those numbers into scientific notation. One way to turn off scientific notation is to use the option function. The options function affects how R computes and displays calculations. These changes are not permeant. It's only for the time that you have the program open. Once you close R studio the default options will turn back on.

This is an example without using the option function

finacial_aid %>%
ggplot(aes(x=`Fiscal Year`,y=sum_aid_dollars)) +
geom_bar(stat='identity')

Next, I will turn off scientific notation by running the options.

options(scipen = 999)

Rerun my code to create the plot

finacial_aid %>%
ggplot(aes(x=`Fiscal Year`,y=sum_aid_dollars)) +
geom_bar(stat='identity')

Scientific notation is turned off. But the numbers on the y axis are still hard to read. R has the scales package to transform axis labels more readable.

--

--

Zaynaib Giwa
Zaynaib Giwa

Written by Zaynaib Giwa

Full Stack Developer | Aspiring Data Scientist | Northwestern Coding Bootcamp Student | Udacity Scholar | Foodie

No responses yet