Try this: aggregate(rep(1, nrow(x)), x, sum)
On Fri, Sep 17, 2010 at 9:19 AM, Alaios <ala...@yahoo.com> wrote: > Hello everyone, > please consider the following lines of a matrix > > > [574,] 59 32 > [575,] 59 32 > [576,] 59 32 > [577,] 59 32 > [578,] 59 32 > [579,] 59 32 > [580,] 59 32 > [581,] 60 32 > [582,] 60 33 > [583,] 60 33 > [584,] 60 33 > [585,] 60 33 > [586,] 60 33 > [587,] 60 33 > [588,] 60 33 > [589,] 60 33 > [590,] 60 33 > [591,] 61 33 > [592,] 61 33 > [593,] 61 33 > [594,] 61 33 > [595,] 61 33 > [596,] 61 33 > [597,] 61 33 > [598,] 61 33 > [599,] 61 33 > [600,] 61 33 > [601,] 62 34 > > Is it possible somehow to count the similarities between the first and > second > column and put them on a third column like this? > > 59 32 3 > 60 33 5 > 62 34 1 > > where (3,5,1 are the frequencies for (59,32), (60,33) and (62,34) > > Best Regards > Alex > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.