I have a 114 row by 16 column data frame where the rows are individuals, and the columns are either their names or NA. For example, the first 3 rows looks like this:
unique does not appear to have an na.rm argument, but you can remove the missing values yourself before calling it:
unique
na.rm
A <- matrix(c(NA,"A","A", "B", NA, NA, NA, NA, "C"), nr=3, byrow=TRUE) apply(A, 1, function(x)unique(x[!is.na(x)]))
gives
[1] "A" "B" "C"