I want to create a graph of the density of the observed temperatures, which is scaled by the number of events observed for each point of the temperature data. My data contains two columns: temperature and number of [observations].
Right now I have a density graph that includes only the temperature frequency according to:
plot(density(Temperature, na.rm=T), type="l", bty="n")
How can I scale this density to account for the number of observations at each temperature? For example, I want to be able to see a graph of the temperature density on a scale to show if there are more / less observations for each temperature at higher / lower temperatures.
I think I'm looking for something that could weigh the temperature?
source share