title: where and how to apply a filter in a ggplot
body: <p>I have a set of data called 'theatres'</p>
  
  <p>I have prepared a box plot of all the data with this code:</p>
  
  <p>There is a column in the data called 'sector' and the data within this column is set to either 'Inpatient' or 'Day case'. I'd like to create two boxplots, one with using only the Inpatient rows, and one with only the Day case rows, i thought to use a filter...</p>
  
  <p>Many thanks if you can help a noob with his first ever question.</p>
  
  <p>I have tried to tag this onto the end of the above code but i get an error, i have also tried the filter before each line of code thinking that the hierachy of the code might be a factor (???)</p>
  
  <pre><code>   ggplot(data = theatre) +
     (mapping = aes( x = speciality_groups, y = process_time, fill = 
     speciality_groups)) +
     geom_boxplot() + labs(x = "Sector", fill = "sector") +
     theme_minimal() + 
     theme(axis.text.x=element_text (angle =45, hjust =1))'
  </code></pre>
  
  <p>trying to use:</p>
  
  <pre><code>   filter(theatre, sector == "Inpatient")
  </code></pre>
  
  <p>I get the following er ror:</p>
  
  <p>Error in ggplot(data = theatre) + (mapping = aes(x = speciality_groups,  : 
     non-numeric argument to binary operator
     In addition: Warning message:
     Incompatible methods ("+.gg", "Ops.data.frame") for "+"</p>