Hi all,

Imagine I have a matrix and the first colum is a list that repeats the same
names, I want to sum the second column on each unique name on first column.

Imagine this:

Pepe 2
Pepe 3
Pepe 4
Jose 2
Jose 5
Manuel 4
Manuel 2

I want to make a new matrix that calculates and recognizes that there are 3
different names ans sum second column. But a priori I don´t know the list of
the different names:

In my example

Pepe 9
Jose 7
Manuel 6

I´m trying to use something like sapply or apply but I can find the key...

Can anyone help or guide me ?

Thanks in advance¡¡¡

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