Hi all,
I have 2 columns in a mtrix, one of which is a column of probabilities and
the other is simply a vector of integers. I want to sum all the
probabilities with the same integer value and put it in a new column.
For example,
If my matrix is:

0.98   2
0.2     1
0.01   2
0.5     1
0.6     6


Then I should get:
0.98   2    0.99
0.2     1    0.70
0.01   2    0.99
0.5     1    0.70
0.6     6    0.60

Any help is greatly appreciated.



-- 
Thanks,
Jim.

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

Reply via email to