Search code examples
rrstudioscientific-notation

number represented as E in spite of using scipen in R


I have a number like '102622812'. I have used scipen as follows

options(scipen=999)

But When I write the number to a file using write.csv, I still get it in a format like 1.03E+08

I have also tried converting this column to character type and writing to the file. I still get the same problem.


Solution

  • Even if the .csv file is saved without scientific notation, spreadsheet software like Excel will display them in scientific notation. Some options to check the real output are:

    • Open the file in a simple text editor, like Notepad or Gedit
    • Use readLines("file.csv") on R.
    • Print the file contents in terminal (type file.csv on Windows, cat file.csv on Linux/Mac).