title: Calculating peaks in histograms or density functions
body: <p>There seem to be a lot of "peaks in density function" threads already, but I don't see one addressing this point specifically. Sorry to duplicate if I missed it.</p>
  
  <p>My problem: Given a vector of 1000 values (sample attached), I would like to identify the peaks in the histogram or density function of the data. From the image of the sample data below , I can see peaks in the histogram at ~0, 6200, and 8400. But I need the obtain the exact values of these peaks, preferably in a simple procedure as I have several thousand of these vectors to process.</p>
  
  <p><img src="https://i.stack.imgur.com/BmyXT.png" alt="Hist and Density Function"></p>
  
  <p>I originally started working with the histogram outputs themselves, but couldn't get any peak-finding command to work properly (like, not at all). I'm not even sure how it would get the <strong>peaks()</strong> command from the <strong>splus2R</strong> package to work on histogram object or on a density object. This would still be my preference, as I would like to identify the exact data value of the max frequency of each peak (as opposed to the density function value, which is slightly different), but I can't figure that one out either.</p>
  
  <p>I would post the sample data themselves, but I can't see a way to do that on here (sorry if I'm just missing it).</p>