You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Neal Richardson (Jira)" <ji...@apache.org> on 2021/05/13 22:36:00 UTC

[jira] [Comment Edited] (ARROW-12781) [R] Implement is.type() functions for dplyr

    [ https://issues.apache.org/jira/browse/ARROW-12781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17344170#comment-17344170 ] 

Neal Richardson edited comment on ARROW-12781 at 5/13/21, 10:35 PM:
--------------------------------------------------------------------

I think we only want them defined in dplyr, and maybe only inside where(). Suppose you defined is.numeric to return TRUE on an Arrow int32() array, and then you call a base R function that has {{if (is.numeric(var) ...}}. That will probably be ugly.


was (Author: npr):
I think we only want them defined in dplyr, and maybe only inside where(). Suppose you defined is.numeric to return TRUE on an Arrow int32() array, and then you call a base R function that has {{if (is.numeric(x) ...}}. That will probably be ugly.

> [R] Implement is.type() functions for dplyr
> -------------------------------------------
>
>                 Key: ARROW-12781
>                 URL: https://issues.apache.org/jira/browse/ARROW-12781
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Ian Cook
>            Priority: Major
>
> Define functions in {{nse_funcs}} for all the important base R generic {{is.type()}} functions, including:
>  * {{is.numeric()}}
>  * {{is.double()}}
>  * {{is.integer()}}
>  * {{is.integer64()}}
>  * {{is.character()}}
>  * {{is.logical()}}
> Maybe also:
>  * {{is.factor() # TRUE for dictionary types}}
>  * {{is.ordered() # TRUE for ordered dictionary types}}
>  * {{is.list() # TRUE for ListArrays}}
> I think the easiest way to implement this would be to check {{$type_id()}} against the {{Type}} enum values, for example:
> {code:r}
> array$type_id() %in% Type[c("UINT8", "INT8", ...)]
> {code}
> For this to also work on unevaluated {{Expression}} columns in {{arrow_dplyr_query}} objects, we would need to call {{$type()}} because there is not currently a {{$type_id()}} method.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)