Quantcast

Why it is happeing?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Why it is happeing?

Bogaso
Dear all, I had following calculations with R:
> x = vector(length = 4)
> x[1] = 1
> x[2] = 3
> x[3] = 123456789123456
> x[4] = -9876543219876
> as.integer(x)
[1]  1  3 NA NA
Warning message:
NAs introduced by coercion

What went wrong?

Thanks and regards,

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Why it is happeing?

Dániel Kehl
"Note that current implementations of*R*use 32-bit integers for integer
vectors, so the range of representable integers is restricted to
about/+/-2*10^9/:|double
<http://stat.ethz.ch/R-manual/R-patched/library/base/html/double.html>|s
can hold much larger integers exactly."

hth
d

2011-11-26 13:05 keltezéssel, Christofer Bogaso írta:

> Dear all, I had following calculations with R:
>> x = vector(length = 4)
>> x[1] = 1
>> x[2] = 3
>> x[3] = 123456789123456
>> x[4] = -9876543219876
>> as.integer(x)
> [1]  1  3 NA NA
> Warning message:
> NAs introduced by coercion
>
> What went wrong?
>
> Thanks and regards,
>
> ______________________________________________
> [hidden email] 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.
>
>

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Loading...