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

Neal Richardson commented on ARROW-14362:
-----------------------------------------

Sure, sounds like something to mention in ARROW-12137. 

Note that {{arrow::case_when}} does not exist.

> [R] Should case_when() work outside mutate()
> --------------------------------------------
>
>                 Key: ARROW-14362
>                 URL: https://issues.apache.org/jira/browse/ARROW-14362
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Dragoș Moldovan-Grünfeld
>            Priority: Minor
>
> Currently {{arrow::case_when()}} has been implemented to work inside an 
> {{arrow::mutate()}} call. As a consequence, this chunk of code errors:
> {code:r}
> arrow_vec <- Array$create(c(1:3, 5:8))
> case_when(arrow_vec < 4 ~ "less than 4", 
>           TRUE ~ "greater than 4")
> Error: LHS of case 1 (`arrow_vec < 4`) must be a logical vector, not a 
> `Array/ArrowDatum/ArrowObject/R6` object.
> {code}
> while the equivalent dplyr code works:
> {code:r}
> library(dplyr)
> num_vec <- c(1:3, 5:8)
> case_when(
>     num_vec < 4 ~ "less than 4",
>     TRUE ~ "greater than 4")
> [1] "less than 4"    "less than 4"    "less than 4"    "greater than 4"
> [5] "greater than 4" "greater than 4" "greater than 4"
> {code}
> This is related to ARROW-13799.



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

Reply via email to