title: R computing mean, median, variance from file with frequency distribution
body: <p>I am very new to R tool and my questions might be a little too obvious.</p>
  
  <p>I have a file that has the following data:</p>
  
  <pre><code>Score     Frequency
  
   100         10
  
   200         30
  
   300         40
  </code></pre>
  
  <p>How do I read this file and compute the mean, median, variance and standard deviation?</p>
  
  <p>If this above table was just raw scores without any frequency information, then I can do this:</p>
  
  <p>x &lt;- scan(file="scores.txt", what = integer())</p>
  
  <p>median(x)</p>
  
  <p>and so on, but I am not able to understand how to do these computations when given a frequency table.</p>