mardi 26 avril 2016

wrong result with if statement in dplyr

Please i'm stuck, I don't know why I get a wrong result after doing an ifelse statement in dplyr

df <- data.frame(A = rep(c("a", "b", "c"), 5), B = 1:15)

df %>%
  mutate(A = ifelse(A %in% c("a","b"), "hello", A))

I don't know why I get "3" ... what I want is c

Aucun commentaire:

Enregistrer un commentaire