if not a in b python code example Example: if not na in r lapply(apply(p, 1, function(x) which(!is.na(x)) ) , paste, collapse=", ")