Skip to content

Commit

Permalink
Merge by case: ensure number is within integer range before convertin…
Browse files Browse the repository at this point in the history
…g to integer
  • Loading branch information
JustinCCYap committed Jul 16, 2021
1 parent 85f46e2 commit ff49b11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/mergedatasetsbycase.R
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,7 @@ combineAsCategoricalVariable <- function(var.list, data.sets,
}
}

if (isIntegerValued(result))
if (isIntegerValued(result) && all(abs(result) <= .Machine$integer.max, na.rm = TRUE))
{
result <- as.integer(result)
nms <- names(merged.val.attr)
Expand Down Expand Up @@ -2357,7 +2357,7 @@ combineAsNumericVariable <- function(var.list, data.sets, v.types)
v
}))

if (isIntegerValued(result))
if (isIntegerValued(result) && all(abs(result) <= .Machine$integer.max, na.rm = TRUE))
result <- as.integer(result)

return(result)
Expand Down

0 comments on commit ff49b11

Please sign in to comment.