library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(datasets)
data(ToothGrowth)
names(ToothGrowth)
## [1] "len"  "supp" "dose"
group_by(.data=ToothGrowth,supp, dose) %>%
          summarise( c = n(),
                     m = mean(len),
                     med = median(len)
                     )
## Source: local data frame [6 x 5]
## Groups: supp
## 
##   supp dose  c     m   med
## 1   OJ  0.5 10 13.23 12.25
## 2   OJ  1.0 10 22.70 23.45
## 3   OJ  2.0 10 26.06 25.95
## 4   VC  0.5 10  7.98  7.15
## 5   VC  1.0 10 16.77 16.50
## 6   VC  2.0 10 26.14 25.95
boxplot(ToothGrowth$len~ToothGrowth$supp+ToothGrowth$dose)

g <-  ggplot(data=ToothGrowth,aes(y=len, x=supp)) +
      geom_boxplot(aes(fill=supp)) + 
      facet_wrap(~dose) 
g