as_duckplyr_df: Convert to a duckplyr data frame

View source: R/as_duckplyr_df.R

as_duckplyr_dfR Documentation

Convert to a duckplyr data frame

Description

These functions convert a data-frame-like input to an object of class "duckpylr_df". For such objects, dplyr verbs such as mutate(), select() or filter() will attempt to use DuckDB. If this is not possible, the original dplyr implementation is used.

as_duckplyr_df() requires the input to be a plain data frame or a tibble, and will fail for any other classes, including subclasses of "data.frame" or "tbl_df". This behavior is likely to change, do not rely on it.

as_duckplyr_tibble() converts the input to a tibble and then to a duckplyr data frame.

Usage

as_duckplyr_df(.data)

as_duckplyr_tibble(.data)

Arguments

.data

data frame or tibble to transform

Details

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

Value

For as_duckplyr_df(), an object of class "duckplyr_df", inheriting from the classes of the .data argument.

For as_duckplyr_tibble(), an object of class c("duckplyr_df", class(tibble())) .

Examples

tibble(a = 1:3) %>%
  mutate(b = a + 1)

tibble(a = 1:3) %>%
  as_duckplyr_df() %>%
  mutate(b = a + 1)

duckdblabs/duckplyr documentation built on Nov. 6, 2024, 10 p.m.