I'm analyzing a batch of data in R which I have plotted the population density on. I would also like to generate a value density plot. For example:
dog.breed weight.lbs
[1] Labrador 63
[2] Maltese 6
[3] Dalmatian 55
[4] Poodle 51
[5] Maltese 4
[6] Dalmatian 48
[7] Poodle 56
The standard density plot will count the # of occurrences for each breed and then output a nice curve, as such:
dog.breed x
[1] Labrador 1
[2] Maltese 2
[3] Dalmatian 2
[4] Poodle 2
However what I am trying to obtain is a similarly smooth curve tracing the sum of the weights for each breed, as such:
dog.breed x
[1] Labrador 63
[2] Maltese 10
[3] Dalmatian 103
[4] Poodle 107
I can do this by establishing a series of points, such as in the final example, and then fitting a curve. But that's messy. I was hoping someone knew of clean package that could do the heavy lifting.
Thanks for the help.
Some Clarification:
How about another example. Suppose I have 50 stores and for every patron I know and how much they spend each time they come to the store. A density plot of the patron population on the stores would reveal information about how many people are attending each store. I'm looking for the equivalent plot, but for how much all people are spending at each store. Meh?