I am attempting to find the elements that are not common across multiple vectors. That is, I want to know exactly the elements (not just their position, etc.) that are not shared across all vectors.
The best implementation I could come up with uses a nested-loop, which I realize is probably the least efficient, most notably because the execution is still running as I write this. Here is what I came up with. (each *.id is a vector of Supreme Court case ID's stored as strings).
check.cases<-TRUE
if(check.cases) {
all.cases<-c(AMKennedy.id,AScalia.id,CThomas.id,DHSouter.id,JGRoberts.id,JPStevens.id,RBGinsburg.id,SAAlito.id,SGBreyer.id)
bad.cases<-c()
for(b in all.cases) {
for(t in all.cases) {
m<-match(t,b)
bad<-t[which(is.na(m))]
bad.cases<-append(bad.cases,bad)
}
}
bad.cases<-unique(bad.cases)
}
print(bad.cases)
There must be a more efficient way of doing this?