tidyverse/duckplyr

Integrate docs: `path` in `duckplyr_df_from_csv()` accepts glob patterns

Closed this issue · 0 comments

Currently: path -> Path to file or directory.

suppressPackageStartupMessages(library(duckplyr))

tbl1 <- tibble::tibble(a = 1)
tbl2 <- tibble::tibble(a = 2)

temp1 <- tempfile(fileext = ".csv")
temp2 <- tempfile(fileext = ".csv")

purrr::walk2(
  list(tbl1, tbl2), 
  list(temp1, temp2), 
  ~ readr::write_csv(x = .x, file = .y)
)

df <- duckplyr_df_from_csv(file.path(dirname(temp1), "*.csv"))
df
#> materializing:
#> ---------------------
#> --- Relation Tree ---
#> ---------------------
#> read_csv_auto(/var/folders/sd/slgy9mrs2494zytqqlydgn7r0000gp/T//RtmpUEtJMM/*.csv)
#> 
#> ---------------------
#> -- Result Columns  --
#> ---------------------
#> - a (BIGINT)
#> 
#>   a
#> 1 2
#> 2 1

Created on 2024-04-04 with reprex v2.1.0