On Feb 9, 2011, at 7:15 AM, PtitBleu wrote:


Hello,

I have a text file with one column containing long number but stored as
string.
I download the file with read.table (and colClass) and the first row of this
column is :

"095842087016731010"

As I need to make some calculations with these numbers, I tried to convert
them using as.numeric.
But then I get
as.numeric("095842087016731010")
95842087016731008

Your number is many powers of ten above the maximum possible integer value 2*10^9. So you are seeing the floating point number that resulted from coercion, and R does not have arbitrary precision arithmetic in its base repertoire.

I understand the disappearing of the first 0 but I don't understand the
substitution of the last 0 by 8.

Is there a way to avoid that ?

There is a package that handles bignums, Brobdingnag.
. And there is interfaces to the symbolic algebra system, Yacas. But.... Do you really need arbitrary precision?


Thanks in advance,
Ptit Bleu.
--


David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to