title: grouped boxplot r ggplot2
body: <p>I have  5 columns of numerical data (Equipment, Hyiene.items etc) and 1 column of categorical data (A or D).
  I'd like to make a grouped boxplot of the numerical data grouped by category but I cannot find a way:</p>
  
  <pre><code> head(sc)
    Equipment Hygiene.items Patient Near.bed Far.bed Care
  1         0             0       1        5       1    D
  2         1             4       1        2       0    D
  3         3             1       1        2       0    D
  4         0             2       2        3       1    A
  5         1             2       1        5       2    A
  6         1             2       1        1       1    A
  </code></pre>
  
  <p><code>boxplot(sc~sc$Care)</code> would seem like the most appropriate way right?
  I like ggplot2 but it doesn't look like i can simply do this:</p>
  
  <pre><code>ggplot(sc, aes(y=sc)) + 
    geom_boxplot(aes(fill=Care))
  </code></pre>
  
  <p><strong>EDIT: What I like the look of:</strong></p>
  
  <p>I think what I'm after is something like this one I made in Matlab (a long time ago):</p>
  
  <p><a href="https://i.stack.imgur.com/So1iL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/So1iL.png" alt="enter image description here"></a></p>
  
  <p>Or the 4th graph on here: <a href="https://plot.ly/r/box-plots/" rel="nofollow noreferrer">Plotly</a></p>
  
  <p><a href="https://i.stack.imgur.com/F4EAn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F4EAn.png" alt="enter image description here"></a> </p>
  
  <p><strong>What I have so far:</strong></p>
  
  <pre><code>library(ggplot2)
  library(RColorBrewer)
  
  ggplot(melt_A,aes(x=Care,y=value,fill=Care))+geom_boxplot(ylim=c(1,6,1))+facet_grid(~variable)+
  labs(x = "Care", y = "Surface contacts",color="Care" )+
    scale_y_continuous(limits = c(-0, 6))+
    scale_fill_brewer(palette="Purples")+
    theme_bw()+
    theme(strip.background=element_rect(fill="black"))+
    theme(strip.text=element_text(color="white", face="bold"))
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>How can I change the Care labels from D, H, Me, to something else? e.g. Direct Care, Housekeeping, Medication round, etc...</p>
  
  <p>Fixed: </p>
  
  <p>Found answer here : <a href="https://stackoverflow.com/questions/23635662/editing-legend-text-labels-in-ggplot">Stack</a></p>
  
  <p>I added the following to my ggplot command</p>
  
  <pre><code>scale_fill_brewer(palette="Purples",
    labels = c("Direct care", "Housekeeping","Medication    round","Mealtimes","Miscellaneous care","Personal care"))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/HwXSs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HwXSs.png" alt="enter image description here"></a></p>