Reputation: 399
I have some 13-digit numbers in an XLS file and I use Excel to generate the CSV file because I need to process it in R.
Then when R read the CSV file, it cannot recognize the big numbers. For example, 1329100082670 would appear like 1.329E+12 in R and lost its precision.
I've tried to format the big numbers as text in Excel and then save it as CSV but that didn't work!
Thanks in advance!
Upvotes: 11
Views: 11197
Reputation: 206232
The numbers are probably all there, by default R doesn't aways show them. See
> a<-1329100082670
> a
[1] 1.3291e+12
> dput(a)
1329100082670
The dput()
shows all the digits are retained even if they display on screen in scientific notation. You can discourage R from using scientific notation by setting the scipen
option. Something like
options(scipen=999)
will turn off most scientific notation. But really, what it looks like on screen shouldn't be too important to you hopefully.
Upvotes: 11