Skip to contents

For an object of class duckplyr_df, dplyr verbs such as mutate(), select() or filter() will attempt to use DuckDB. If this is not possible, the original dplyr implementation is used.

Usage

as_duckplyr_df(.data)

Arguments

.data

data frame or tibble to transform

Value

An object of class "duckplyr_df", inheriting from the classes of the .data argument.

Details

Set the DUCKPLYR_FALLBACK_INFO and DUCKPLYR_FORCE environment variables for more control over the behavior, see config for more details.

Examples

tibble(a = 1:3) %>%
  mutate(b = a + 1)
#> # A tibble: 3 × 2
#>       a     b
#>   <int> <dbl>
#> 1     1     2
#> 2     2     3
#> 3     3     4

tibble(a = 1:3) %>%
  as_duckplyr_df() %>%
  mutate(b = a + 1)
#> materializing:
#> ---------------------
#> --- Relation Tree ---
#> ---------------------
#> Projection [a as a, +(a, 1.0) as b]
#>   r_dataframe_scan(0x55ad0377ff30)
#> 
#> ---------------------
#> -- Result Columns  --
#> ---------------------
#> - a (INTEGER)
#> - b (DOUBLE)
#> 
#> # A tibble: 3 × 2
#>       a     b
#>   <int> <dbl>
#> 1     1     2
#> 2     2     3
#> 3     3     4