mutate_nse: mutate non-standard evaluation interface.

View source: R/mutate_nse.R

mutate_nseR Documentation

mutate non-standard evaluation interface.

Description

Mutate a data frame by the mutate terms from ....

Usage

mutate_nse(
  .data,
  ...,
  mutate_nse_split_terms = TRUE,
  mutate_nse_env = parent.frame(),
  mutate_nse_warn = TRUE,
  mutate_nse_printPlan = FALSE
)

Arguments

.data

data.frame

...

expressions to mutate by.

mutate_nse_split_terms

logical, if TRUE into separate mutates (if FALSE instead, pass all at once to dplyr).

mutate_nse_env

environment to work in.

mutate_nse_warn

logical, if TRUE warn about name re-use.

mutate_nse_printPlan

logical, if TRUE print the expression plan

Details

Note: this method as the default setting mutate_nse_split_terms = TRUE, which is safer (avoiding certain known dplyr/dblyr issues) (please see the side-notes of https://winvector.github.io/FluidData/partition_mutate.html for some references).

Value

.data with altered columns.

See Also

mutate_se, mutate, mutate_at, :=

Examples



limit <- 3.5

datasets::iris %.>%
  mutate_nse(., Sepal_Long := Sepal.Length >= 2 * Sepal.Width,
                Petal_Short := Petal.Length <= limit) %.>%
  head(.)

# generates a warning
data.frame(x = 1, y = 2) %.>%
   mutate_nse(., x = y, y = x)


WinVector/seplyr documentation built on Aug. 26, 2022, 12:01 p.m.