How to plot several boxplots by group in r?
<pre><code>ID &lt;- 1:10 
group &lt;- c(1,1,1,2,2,2,3,3,3,3)
var1 &lt;- c(6:15) 
var2 &lt;- c(7:16) 
var3 &lt;- c(6:11, NA, NA, NA, NA)
var4 &lt;- c(4:9, NA, NA, NA, NA) 
data &lt;- data.frame(ID, group, var1, var2, var3, var4)

library(dplyr)
 data %&gt;% group_by(group) %&gt;% boxplot(var1, var2)
</code></pre>

<p>The last line does not work as i wish. The idea is to get 4 boxplots in one graphic. Two for each variable. Maybe i need to use ggplot2?</p>