mutate_filter {quickcode}R Documentation

Mutate only a subset of dataset intact

Description

Extension of the dplyr::mutate function that allows the user to mutate only a specific filtered subset of a data, while leaving the other parts of the data intact

Usage

mutate_filter(., sub.set, ...)

Arguments

.

data object

sub.set

subset of data to modify

...

mutation syntax similar to dplyr::mutate

Value

data frame containing original data, but with a subset mutated

Examples

#mutate a subsection filter of mtcars
dt = mtcars
names(dt)
head(dt)
mutate_filter(dt,mpg == 21.0 & cyl == 6, cyl=1000,hp=2000,vs=hp*2)


dt2 = beaver1
names(dt2)
head(dt2)
mutate_filter(dt2, day == 346 & time < 1200, activ = 12, temp = round(temp*10,1))

[Package quickcode version 0.9.1 Index]