Re: [R] Comparison of vectors in a matrix

2009-11-11 Thread esterhazy
Yes, thanks for this, this is exactly what I want to do. However, I have a remaining problem which is how to get R to understand that each entry in my matrix is a vector of names. I have been trying to import my text file with the names in each vector of names enclosed in quotes and separated

Re: [R] Comparison of vectors in a matrix

2009-11-11 Thread David Winsemius
On Nov 11, 2009, at 1:02 PM, esterhazy wrote: Yes, thanks for this, this is exactly what I want to do. However, I have a remaining problem which is how to get R to understand that each entry in my matrix is a vector of names. I have been trying to import my text file with the names in

Re: [R] Comparison of vectors in a matrix

2009-11-11 Thread Tony Plate
This is a tricky data entry problem. The right technique will depend on the fine details of the data, and it's not clear what those are. E.g., when you say In my first column, for example, I have henry , it's unclear to me whether or not the double quotes are part of the data or not - which

Re: [R] Comparison of vectors in a matrix

2009-11-11 Thread esterhazy
That is wonderful, now I think I am all set! Thanks again! Tony Plate wrote: This is a tricky data entry problem. The right technique will depend on the fine details of the data, and it's not clear what those are. E.g., when you say In my first column, for example, I have henry , it's

[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. Is

Re: [R] Comparison of vectors in a matrix

2009-11-10 Thread Tony Plate
Nice problem! If I understand you correctly, here's how to do it (with list-based matrices): set.seed(1) (x - matrix(lapply(rpois(10,2)+1, function(k) sample(letters[1:10], size=k)), ncol=2, dimnames=list(1:5,c(A,B A B 1 Character,2 Character,5 2 Character,2