You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "eitsupi (via GitHub)" <gi...@apache.org> on 2023/10/26 15:11:22 UTC

Re: [I] [R] How to replace NA with another value using arrow or R libraries [arrow]

eitsupi commented on issue #38473:
URL: https://github.com/apache/arrow/issues/38473#issuecomment-1781324329

   The query you want to do is probably something like this:
   
   ``` r
   df <- data.frame(a = 1:3, b = c(1, NA, 3))
   df |>
     arrow::as_arrow_table() |>
     dplyr::mutate(dplyr::across(everything(), ~ dplyr::coalesce(.x, 0))) |>
     dplyr::collect()
   #> # A tibble: 3 × 2
   #>       a     b
   #>   <dbl> <dbl>
   #> 1     1     1
   #> 2     2     0
   #> 3     3     3
   ```
   
   <sup>Created on 2023-10-26 with [reprex v2.0.2](https://reprex.tidyverse.org)</sup>
   
   `tidyr::replace_na` can be accomplished using `dplyr::across` and `dplyr::coaless`.
   Please check the document <https://tidyr.tidyverse.org/reference/replace_na.html#see-also>.
   
   See also https://github.com/apache/arrow/issues/36458#issuecomment-1624594686


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org