Re: [R] Aggregate rows to see the number of occurences

2004-06-07 Thread Nicolas STRANSKY
Petr Pikal wrote: Oops, you wanted to count number of pairs, this modification should work int<-interaction(tab[,1],tab[,2]) counts<-table(int) count.no<-names(counts) selection<-match(int,count.no) cbind(tab,no=as.numeric(counts[selection])) Yes, thank's for all your answers. This is a way to do

Re: [R] Aggregate rows to see the number of occurences

2004-06-07 Thread Christophe Pallier
> I have a set of data like the following: [,1] [,2] [1,] 102 ... [10,] 195 I'd like to aggregate it in order to obtain the frequency (the number of occurences) for each couple of values (e.g.: (10,2) appears twice, (7,0) appears once). Something cool would be to have this value

Re: [R] Aggregate rows to see the number of occurences

2004-06-07 Thread Petr Pikal
Oops, you wanted to count number of pairs, this modification should work int<-interaction(tab[,1],tab[,2]) counts<-table(int) count.no<-names(counts) selection<-match(int,count.no) cbind(tab,no=as.numeric(counts[selection])) Cheers Petr On 7 Jun 2004 at 13:05, Petr Pikal wrote: > Hallo >

Re: [R] Aggregate rows to see the number of occurences

2004-06-07 Thread Petr Pikal
Hallo On 7 Jun 2004 at 12:18, Nicolas STRANSKY wrote: > Hi, > > I have a set of data like the following: >[,1] [,2] > [1,] 102 > [2,]70 > [3,]10 > [4,]10 > [5,] 150 > [6,] 174 > [7,]40 > [8,] 198 > [9,] 102 > [10,] 195

[R] Aggregate rows to see the number of occurences

2004-06-07 Thread Nicolas STRANSKY
Hi, I have a set of data like the following: [,1] [,2] [1,] 102 [2,]70 [3,]10 [4,]10 [5,] 150 [6,] 174 [7,]40 [8,] 198 [9,] 102 [10,] 195 I'd like to aggregate it in order to obtain the frequency (the number of occurences) f