[
https://issues.apache.org/jira/browse/ARROW-6365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16922911#comment-16922911
]
Neal Richardson commented on ARROW-6365:
----------------------------------------
While working on something else, I noticed this test, which suggests that the
current behavior is intentional and not just not-yet-implemented:
https://github.com/apache/arrow/blob/master/r/tests/testthat/test-Array.R#L390-L398
Thoughts [~romainfrancois]?
> [R] Should be able to coerce numeric to integer with schema
> -----------------------------------------------------------
>
> Key: ARROW-6365
> URL: https://issues.apache.org/jira/browse/ARROW-6365
> Project: Apache Arrow
> Issue Type: Improvement
> Components: R
> Reporter: Neal Richardson
> Priority: Minor
> Fix For: 0.15.0
>
>
> R is flexible when it comes to integer vs. floating point, generally
> obscuring the details inside a "numeric" class, but it knows how to make it
> seem like my integer-looking data stored in a double is actually integer.
> This means that an R user can think they have integers even when the
> underlying storage is not.
> So I would have expected this to work, and indeed to be one reason I'd want
> to specify a schema when creating a table:
> {code:r}
> > table(a = 1, schema = schema(a = int32()))
> Error in Table__from_dots(dots, schema) :
> Invalid: Cannot convert R vector of type REALSXP to integer Arrow array
> {code}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)