I have a large dataset of samples with descriptors of whether the sample is viable - it looks (kind of) like this, where \'desc\' is the description column and \'blank\' ind
You can use dplyr and a custom function to mutate values on certain conditions.
`
library(dplyr)
mutate_cond <- function(.data, condition, ..., envir = parent.frame()) {
condition <- eval(substitute(condition), .data, envir)
.data[condition, ] <- .data[condition, ] %>% mutate(...)
.data
}
data <- data %>%
mutate_cond( desc == "blank", x = NA, y = NA, z = NA)
`