dimanche 1 août 2021

How to replace NA with a string based on a condition in R?

I have the following data:

name <- c(NA, NA)
code <- c("KSV", "KSV")
testing_data <- cbind.data.frame(name, code) 

For all code == "KSV", I want to replace the NA with "Kosovo". Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire