Using conditional selection to subset multiple variables in a dataset : <p>I need to use conditional selection to create a subset of the data with records from the control group, weight > 440, and DMI > 13. I also need to find the cattle breed with the largest number of records in this subset of data.</p>

<p>The code I tried was:</p>

<pre><code>&gt; dat2[dat2$Treatment == "control" &amp; dat2$Weight&gt;440 &amp; dat2$DMI &gt;13]
</code></pre>

<p>but I am not sure that is correct.</p>

<pre><code>&gt; dput(head(dat2))
structure(list(Animal = 1:6, Weight = c(455.96, 418.05, 436.31, 
448.22, 418.35, 467.78), DMI = c(14.81, 17.63, 17.81, 15.01, 
15.42, 12.58), Breed = structure(c(3L, 3L, 2L, 2L, 3L, 3L), .Label = 
c("Angus", 
"Brahman", "Hereford", "Nelore"), class = "factor"), Treatment = 
structure(c(1L, 
3L, 1L, 1L, 3L, 1L), .Label = c("Control", "High", "Low"), class = ]
"factor"), 
Sex = structure(c(1L, 1L, 2L, 2L, 1L, 1L), .Label = c("Castrate", 
"Female", "Male"), class = "factor")), .Names = c("Animal", 
"Weight", "DMI", "Breed", "Treatment", "Sex"), row.names = c(NA, 
6L), class = "data.frame")
</code></pre>
