Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in R Programming by (5.3k points)

Can I force R to use regular numbers instead of using the e+10-like notation? I have:

# and 
within the same vector and want to see:
# and
I am creating output for an old fashioned program and I have to write a text file using cat. That works fine so far but I simply can't use the e+10 notation there.

1 Answer

0 votes

To achieve this, you have to disable the scientific notations in R using the scipen option from the options function, which does the following

Scipen:- A penalty to be applied when deciding to print numeric values in fixed or exponential notation. Positive values bias towards fixed and negative towards scientific notation: fixed notation will be preferred unless it is more than scipen digits wider.

To disable exponential format/scientific notations:


For example:

 num <- c(2.21e+09, 7)options("scipen"=100, "digits"=4) 


[1] 2210000000          7

Note: This will disable the scientific notation in the global setting.

To disable scientific notation for a particular function, use the following:

format(functionResult, scientific=FALSE)

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.1k users

Browse Categories