title: split data frame into two by column value
body: <p>I have a data frame in R where one of the columns is <code>gender</code>. The values of <code>gender</code> are factors with "f" or "m" though if the data set is bad, it could be more (for instance NA).</p>
  
  <p>I'm trying to split the data frame into a list of data frames with gender being unique. This way I can run the same models on the different populations.</p>
  
  <p>Is there a better way then basically:</p>
  
  <pre><code>dfMale &lt;- mydata[which(mydata$gender == "m"),]
  dfFemale &lt;- mdata[which(mydata$gender == "f"),]
  dfOther &lt;- mydata[!(1:dim(mydata][1] %in% c(which(mydata$gender == "m"),which(mydata$gender == "f"))]
  </code></pre>
  
  <p>Thanks.</p>