where-table.express: Where clause

where-table.expressR Documentation

Where clause

Description

Clause for subsetting rows.

Usage

where(.data, ...)

## S3 method for class 'ExprBuilder'
where(
  .data,
  ...,
  which,
  .collapse = `&`,
  .parse = getOption("table.express.parse", FALSE),
  .chain = getOption("table.express.chain", TRUE)
)

## S3 method for class 'data.table'
where(.data, ...)

Arguments

.data

The input data.

...

Arguments for the specific methods.

which

Passed to data.table::data.table.

.collapse

A boolean function which will be used to "concatenate" all conditions in ....

.parse

Logical. Whether to apply rlang::parse_expr() to obtain the expressions.

.chain

Logical. Should a new frame be automatically chained to the expression if the clause being set already exists?

Details

For ExprBuilder, the expressions in ... can call nest_expr(), and are eagerly nested if they do.

The data.table::data.table method is lazy, so it expects another verb to follow afterwards.

To see more examples, check the vignette, or the table.express-package entry.

Examples


data("mtcars")

data.table::as.data.table(mtcars) %>%
    start_expr %>%
    where(vs == 0, am == 1)


data.table::as.data.table(mtcars) %>%
    where(vs == 0) %>%
    transmute(mpg = round(mpg))


table.express documentation built on April 3, 2023, 5:43 p.m.