title: Barplot/histogram using frequencies in R
body: <p>Suppose you have two vectors, where the first vector is a vector of values a variable takes, and second is the probability (frequency) of this value. It should look like this:</p>
  
  <pre><code> a &lt;- c(2.1,7.5,5.2,6,5.8)
   b &lt;- c(1/8,1/8,1/3,5/24,5/24)
  </code></pre>
  
  <p>I have a lot of those combinations of vectors. Suppose values in all <code>a</code> vectors are in range from 1 to 10. </p>
  
  <p>What i need is two different graphs:</p>
  
  <ul>
  <li><p>First is a barplot/histogram of values of <code>a</code> based on frequencies <code>b</code> (so heights of bars are equal to frequencies), and values on x axis include only the ordered values of <code>a</code>, </p></li>
  <li><p>second is a similar graph, but on x axis should be all possible values of  <code>a</code> vectors - so the axis should be from 1 to 10 and the bars should only be  above the relevant values of <code>a</code>. </p></li>
  </ul>
  
  <p>In both cases bars should have same width. My question is: How to plot these graphs?</p>
  
  <p>I really think that what I want is called histogram but before I posted this question I made research on this web, and I became very confused about bar plots and histograms.</p>