سؤال

I would like to find if a vector has NAs that are non leading or trailing.

For example, c(NA, NA,1,8,6, NA,NA, 5, 11, 16,15, 18, NA, NA) should return TRUE, and c(NA, NA,1,8,6, 7,8, 5, 11, 16,15, 18, NA, NA) should return FALSE.

Does anyone know how to write this?

هل كانت مفيدة؟

المحلول

length(rle(is.na(c(NA, x, NA)))$values) > 3

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top