title: Can't seem to get subset() working in r
body: <p>Say I want to look at a subset whose age is 55 to 100, to look at their health care costs.</p>
  
  <p>I've used:</p>
  
  <pre><code>Elders &lt;- subset(midus, Age&gt;= 55 | Age&lt;100)
  mean(Elders$Cost, na.rm=TRUE)
  #78.8445
  </code></pre>
  
  <p>I understand this should give me the mean cost for people between 55 and 100.  In this case, it's 78.8445</p>
  
  <p>Sounds great.  BUT, to check, I compare it to ages 95-100:</p>
  
  <pre><code>Elders2&lt;-subset(midus,Age&gt;=95 | Age&lt;100)
  mean(Elders2$Cost, na.rm=TRUE)
  #78.8445
  </code></pre>
  
  <p>It seems very unlikely to me that these two subsets have identical means.  And I can't figure out what I did wrong to make it think that they do.  Anyone have any ideas?</p>
  
  <p>Appreciate the help.  I've lurked stack overflow since starting this class and it's helped me immensely.  </p>