title: Subsetting from a Data Frame
body: <p>I'm early in the process of learning R. Say I have a data frame with a column named "Gender". If I want to retrieve all rows where Gender is "female" there are at least two ways I can do this:</p>
  
  <pre><code>FemaleSmokers &lt;- df[df$Gender=="female", , drop = FALSE]
  FemaleSmokers &lt;- subset(df, Gender=="female")
  </code></pre>
  
  <p>1) Is there a best practice on when to use one over the other?
  2) In the first approach, why do I need to preface the column with the name of the data frame when R should know which data frame I working with.</p>