rp_filter: Filter rows using pandas

View source: R/verbs_filter.R

rp_filterR Documentation

Filter rows using pandas

Description

Filters a data frame using an R expression translated to pandas.

Usage

rp_filter(.data, filter_expression, table_name = NULL, return.as = "result")

Arguments

.data

An R data.frame or tibble.

filter_expression

The filtering expression, written in R syntax.

table_name

An optional character string. If provided, the generated Python code will replace the internal dataframe name with this string (e.g., "diamonds.query(...)"). This is useful for seeing the exact, copy-pasteable Python code. Defaults to NULL (uses "df").

return.as

What to return: "result", "code", or "all".

Value

A data.frame containing the filtered rows.

Examples


if (reticulate::py_available(initialize = TRUE) &&
    reticulate::py_module_available("pandas")) {
      rp_filter(ggplot2::diamonds, carat > 1 & price < 4000)
}


rPandas documentation built on April 29, 2026, 1:07 a.m.