suppress NAs in paste()
Regarding the bounty Ben Bolker 's paste2 -solution produces a "" when the strings that are pasted contains NA 's in the same position. Like this, > paste2(c("a","b", "c", NA), c("A","B", NA, NA)) [1] "a, A" "b, B" "c" "" The fourth element is an "" instead of an NA Like this, [1] "a, A" "b, B" "c" NA I'm offering up this small bounty for anyone who can fix this. Original question I've read the help page ?paste , but I don't understand how to have R ignore NA s. I do the following, foo <- LETTERS[1:4] foo[4] <- NA foo [1] "A" "B" "C" NA paste(1:4, foo, sep = ", ") and get [1] "1, A" "2, B" "3,