mercredi 27 octobre 2021

How do I "do nothing" when using the dplyr ifelse() in R?

I am looking to use the ifelse() with mutate(), and if the condition is false, leave the value what is. Here is what I am working with:

df <- df %>% mutate(column1 = ifelse(is.na(column1), 0, "insert code to do nothing"))

Aucun commentaire:

Enregistrer un commentaire