I'm trying to use the mutate_at
function with ifelse
but it does not work.
As an example here is what I want to achieve
data <- data.frame(
A = c(1, 2, 3, 4),
B = c(2, 3, 4, 1),
C = c(4, 1, 9, 0)
)
data %>%
mutate(A = ifelse(A == 4, 1, A)) %>%
mutate(B = ifelse(B == 4, 1, B))
by using the mutate_at
function. Any help would be appreciated.
question from:
https://stackoverflow.com/questions/65861598/how-to-use-mutate-at-with-ifelse 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…