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

1.810032e+09# and4

1810032000# and4

Login

0 votes

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

1.810032e+09# and4

within the same vector and want to see:

1810032000# and4

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.

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:

options(scipen=999)

For example:

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

num

[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)