How can I put the diff elements b/w factor_Nov and factor_Jan in a new column called diff
df=data.frame(id=c("1","2","3"),
factor_Nov=c("A|B|C","E","F|H|G"),
factor_Jan=c("B|H|E","E","X|Y|Z"))
the output should be
df=data.frame(id=c("1","2","3"),
factor_Nov=c("A|B|C","E","F|H|G"),
factor_Jan=c("B|H|E","E","X|Y|Z"),
diff=c("A|C|H|E",NA,"X|Y|Z|F|H|G"))
I tried setdiff but that wasn't working