mutate_cond: Change values in a tibble if some condition is fulfilled.

View source: R/differential_nichenet.R

mutate_condR Documentation

Change values in a tibble if some condition is fulfilled.

Description

mutate_cond Change values in a tibble if some condition is fulfilled. Credits: https://stackoverflow.com/questions/34096162/dplyr-mutate-replace-several-columns-on-a-subset-of-rows.

Usage

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

Arguments

.data

Data frame / tibble

condition

A condition that need to be fulfilled.

...

The change that need to happen if condition fulfilled – through the use of 'dplyr::mutate()'

envir

parent.frame() by default

Value

A tibble

Examples

## Not run: 
mutate_cond(df, a == 3, b = 4)

## End(Not run)


browaeysrobin/nichenetr documentation built on Sept. 9, 2024, 11:25 a.m.