[ https://issues.apache.org/jira/browse/ARROW-14028?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonathan Keane updated ARROW-14028: ----------------------------------- Fix Version/s: (was: 9.0.0) > [R] Cast of NaN to integer should return NA_integer_ > ---------------------------------------------------- > > Key: ARROW-14028 > URL: https://issues.apache.org/jira/browse/ARROW-14028 > Project: Apache Arrow > Issue Type: Improvement > Components: R > Reporter: Ian Cook > Priority: Major > > Casting doubleĀ {{NaN}} to integer returns a sentinel value: > {code:r} > call_function("cast", Scalar$create(NaN), options = list(to_type = int32(), > allow_float_truncate = TRUE)) > #> Scalar > #> -2147483648 > call_function("cast", Scalar$create(NaN), options = list(to_type = int64(), > allow_float_truncate = TRUE)) > #> Scalar > #> -9223372036854775808{code} > It would be nice if this would instead return {{NA_integer}}. > N.B. for some reason this doesn't reproduce in dplyr unless you round-trip it > back to double: > {code:r} > > Table$create(x = NaN) %>% transmute(as.double(as.integer(x))) %>% pull(1) > #> [1] -2147483648{code} -- This message was sent by Atlassian Jira (v8.20.10#820010)