RE: [R] Newbie: Matrix indexing

2005-03-22 Thread Eric Lecoutre
Hi Pascal, One thing you can do is to work on indexes, count unique occurences and assign them, as following: index - as.data.frame(table(index[,1],index[,2])) index - do.call(cbind,lapply(index, as.numeric)) # ensures numeric coding (as table turns into factors) occurence[index[,1:2]] -

Re: [R] Newbie: Matrix indexing

2005-03-22 Thread Gabor Grothendieck
Pascal BLEUYARD p.bleuyard at opgc.univ-bpclermont.fr writes: : : Hi all, : : I need to compute some occurence matrix: given a zero matrix and a set : of paired indexes, I want to store the number of occurences of each paired : index in a matrix. The paired indexes are stores as an index