I am using R to process data, save them as csv, and load them into other tools. Those tools cannot read letters in numeric columns.
When I save a file with write_csv, very small and very large (absolutely) numbers are automatically written in scientific notation.
Example:
options(scipen = 999)
df <- tibble(a = -0.000005,
b = 0.00019)
write_csv(df, "test.csv")
A similar question was asked here: Turn off scientific notation before writing to file and here: readr : Turn off scientific notation in write_csv
The answers have been to save the columns as strings, save via write.csv() or to load the data in other tools differently. These are all bypasses without really tackling the issue.
The issue about unwanted scientific notation was also discussed in github https://github.com/tidyverse/readr/issues/845 https://github.com/tidyverse/readr/pull/679 https://github.com/tidyverse/readr/issues/671 and https://github.com/tidyverse/readr/issues/957 without any answer or future path.
One argument evolves around precison, but when I write the file with write_csv2() from the same readr package, the numbers are not converted into scientific notation. So here is an inconsistency, I don't understand.
Is there really no way using write_csv() to get rid of the scientific notation? I really like tidyverse and readr and cannot really understand why it's not possible to switch off scientific notation of write_csv(). Or am I missing something?
I am thankful for any help!