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/09/24 11:53:11 UTC

[GitHub] [arrow] eitsupi commented on issue #37758: [R] Add tbl_vars method

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

   @ablack3 Isn't the problem that you're not using `where`?
   Please check the warning shown in your example.
   
   > Warning: Use of bare predicate functions was deprecated in tidyselect 1.1.0.
   > ℹ Please use wrap predicates in `where()` instead.
   >   # Was:
   >   data %>% select(is.numeric)
   > 
   >   # Now:
   >   data %>% select(where(is.numeric))
   
   It works.
   
   ``` r
   library(arrow, warn.conflicts = FALSE)
   library(dplyr, warn.conflicts = FALSE)
   
   write_dataset(cars, file.path(tempdir(), "cars.parquet"))
   
   ds <- open_dataset(file.path(tempdir(), "cars.parquet"))
   
   ds |>
       mutate(across(where(is.numeric), list(newcolumn = ~ .x * 10))) |>
       collect()
   #> # A tibble: 50 × 4
   #>    speed  dist speed_newcolumn dist_newcolumn
   #>    <dbl> <dbl>           <dbl>          <dbl>
   #>  1     4     2              40             20
   #>  2     4    10              40            100
   #>  3     7     4              70             40
   #>  4     7    22              70            220
   #>  5     8    16              80            160
   #>  6     9    10              90            100
   #>  7    10    18             100            180
   #>  8    10    26             100            260
   #>  9    10    34             100            340
   #> 10    11    17             110            170
   #> # ℹ 40 more rows
   ```
   
   <sup>Created on 2023-09-24 with [reprex v2.0.2](https://reprex.tidyverse.org)</sup>


-- 
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