I have a set of numeric vectors in R each length 16. I would like to select those vectors that have all values present in one of four positions: 1:4, 5:8, 9:12, 13:16
e.g. vector c(NA, 1, NA, 1, 1, 1, 1, 1, NA, NA, 1, NA, NA, 1, NA, 1, NA)
would pass the test, since positions 5:8 are all non NA.
What is the most elegant (i.e. using minimum easy-to-read code) way to test this?
Aucun commentaire:
Enregistrer un commentaire