[R] Unexpected R Behavior: Adding 4 to Large Numbers/IDs Containing Current Year

Peter Langfelder peter.langfelder at gmail.com
Wed Jun 29 20:41:18 CEST 2011


You seem to be running into the limits of double-precision - your IDs
have 17 "significant" digits which is more than the double precision
floating point number can hold without any rounding errors.

Since you are using these numbers as IDs, simply keep them as
character strings throughout your code, and nothing will ever change.
Or shorten the IDs by a few digits and your IDs will be safe again.

HTH,

Peter

On Wed, Jun 29, 2011 at 11:29 AM, Christopher T. Moore <moor0554 at umn.edu> wrote:
> Hello,
>
> I have encountered some unexpected behavior in R that seems to occur as a
> result of having the current year embedded in a number:



More information about the R-help mailing list