When you create a vector with c() , the NULL value is ignored:
things <- c('M','F',NULL) things [1] "M" "F"
However, if it is important to pass NULL downstream, you can use list instead:
things <- list('M','F',NULL) for (thing in things){ print(thing) } [1] "M" [1] "F" NULL
source share