You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/07/18 15:21:59 UTC

[GitHub] [arrow-cookbook] eitsupi commented on issue #83: [R] Recipe for random sampling

eitsupi commented on issue #83:
URL: https://github.com/apache/arrow-cookbook/issues/83#issuecomment-1187635564

   I think this is a great use case for combining `arrow` and `duckdb`.
   There is no support for slice_* functions in `arrow` and `duckdb` does not yet have the ability to open a dataset.
   
   ```r
   library(arrow)
   library(dplyr)
   
   tf <- tempfile()
   dir.create(tf)
   
   nycflights13::flights |>
     group_by(month) |>
     write_dataset(tf)
   
   df <- open_dataset(tf, hive_style = TRUE) |>
     group_by(month) |>
     to_duckdb() |>
     slice_sample(n = 2) |>
     collect()
   ```


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