0

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.

tubby
  • 2,074
  • 3
  • 33
  • 55
  • 1
    How did you check the value in the .csv file? From the capital `E` I suppose Excel, and if so it's because Excel is displaying in scientific format. – Molx Jun 27 '15 at 22:30
  • @Molx, you're right. From R, it was a number, Excel was converting it to scientific notation. Thanks! – tubby Jun 27 '15 at 22:35
  • This is worth posting as an answer. I imagine it happens to more than a few people, even if it seems rather elementry. SO is for beginners too. – Mike Wise Jun 27 '15 at 23:19

1 Answers1

2

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).
Molx
  • 6,816
  • 2
  • 31
  • 47