-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Values larger than .Machine$integer.max or smaller than -.Machine$integer.max result in a warning and a missing value (djvanderlaan/datapackage#23):
> yaml.load("foo: 9876543219")
$foo
[1] NA
Warning message:
In yaml.load("foo: 9876543219") :
NAs introduced by coercion: 9876543219 is out of integer range
Probably better would be to convert to double in such cases. Doubles can handle without loss of precision values up to 2^52 (or 53; can't remember); or use int64 introducing a dependency on bit64.
A current workaround for me is:
yaml.load("foo: 9876543219", handlers=list(int=function(x) {
x <- as.numeric(x);
if (x <= .Machine$integer.max & x >= .Machine$integer.max) as.integer(x) else x
}))
Metadata
Metadata
Assignees
Labels
No labels