title: Total sum of a numeric vector conditional on values from a character vector
body: <p>x is a numeric vector and y is a character vector, both of the same length.
  I have to obtain the total sum of x for each character in y.
  So for example if y has the letters of the alphabet, the algorithm must sum all the values of x that indexed by a "A" and then all the values indexed by a "B", etc. It seems it can be done with the aggregate function but I haven't been able to figure out how.</p>