This cant be too hard, but I'm stuck.
x1 <- c(1, 1, 1, 2)
x2 <- c(NA, NA, 1, 2, 3)
x3 <- c(NA, NA, NA)
I have three possible vectors. They can either have no NAs (x1), some NAs (x2) or only NAs (x3). I want an operation to be performed only when there are some NAs but not when there are only NAs.
How do I write the condition that returns TRUE only if some of the elements are NA (but FALSE when all or none of them are NA).
Desired output
- x1 FALSE
- x2 TRUE
- x3 FALSE
Aucun commentaire:
Enregistrer un commentaire