Re: [R] Comparison of vectors in a matrix

2009-11-11 Thread esterhazy
quot; >> # use R's parsing and evaluation to turn '"a", "b"' into c("a", "b"), and >> turn that >> # into a matrix containing character vectors of various lengths. >> matrix(lapply(parse(text=paste("c(", x, &qu

Re: [R] Comparison of vectors in a matrix

2009-11-11 Thread esterhazy
uot;c" "d" "a" "j" "f" > >> (y <- cbind(x, "A-B"=apply(x, 1, function(ab) setdiff(ab[[1]], >> ab[[2]] > A B A-B > 1 Character,2 Character,5 "b" > 2 Character,2 Charact

[R] Comparison of vectors in a matrix

2009-11-10 Thread esterhazy
Hi, I have a matrix with two columns, and the elements of the matrix are vectors. So for example, in line 3 of column 1 I have a vector v31=("marc", "robert, "marie"). What I need to do is to compare all vectors in column 1 and 2, so as to get, for example setdiff(v31,v32) into a new column. I