mutate_nse: mutate non-standard evaluation interface.

Description Usage Arguments Details Value See Also Examples

View source: R/mutate_nse.R

Description

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

Usage

1
2
3
4
5
6
7
8
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

seplyr documentation built on Sept. 5, 2021, 5:12 p.m.