Phdaml - 3 months ago 15

R Question

I have a lot of long numbers and r reads them as scientific notation. But when I

`write.csv`

`3.894e+13`

`38944400000000`

`write.csv.`

I have exact numbers in the place where the zeros are.

How do I keep the exact number when exporting a data file?

[

(1) The problem is because when I save as csv in excel, it loses digits of long numbers. It is an excel bug and I use excel 2016.

(2) when the above problem occurred, I tired to set

`options(scipen=999)`

`summary`

Answer

Set the the `scipen`

option to be a large enough number before writing the csv file is one way to make it work:

```
df = data.frame(x = 1232939143546532)
options(scipen = 30)
write.csv(df, "test.cv")
```

This gives the following:

```
"","x"
"1",1232939143546532
```