mutate_cond: Conditional mutate

View source: R/mutate_cond.R

mutate_condR Documentation

Conditional mutate

Description

mutate_cond mutates the data.frame only on the rows that satisfy the condition.

Usage

mutate_cond(.data, condition, ..., envir = parent.frame())

Arguments

.data

data.frame

condition

expression with the condition to be evaluated

...

arguments passed to mutate

envir

environment inherited from parent.frame()

Value

data.frame

Examples

library(dplyr)
library(magrittr)
data(iris)
iris %>%
   mutate(aux = 0) %>%
   mutate_cond(Petal.Length > 1.3,aux = 3)


amorris28/amorris documentation built on Nov. 24, 2022, 6:39 a.m.