example(ToothGrowth)
##
## TthGrw> require(graphics)
##
## TthGrw> coplot(len ~ dose | supp, data = ToothGrowth, panel = panel.smooth,
## TthGrw+ xlab = "ToothGrowth data: length vs dose, given type of supplement")
dta <- ToothGrowth
str(ToothGrowth)
## 'data.frame': 60 obs. of 3 variables:
## $ len : num 4.2 11.5 7.3 5.8 6.4 10 11.2 11.2 5.2 7 ...
## $ supp: Factor w/ 2 levels "OJ","VC": 2 2 2 2 2 2 2 2 2 2 ...
## $ dose: num 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
aggregate(len ~ supp, dat=ToothGrowth, FUN=length)
## supp len
## 1 OJ 30
## 2 VC 30
lattice::bwplot(len ~ supp, data=dta,
main="boxplot of length at different supplements", xlab="Sup(OJ & VC)", ylab="Len")


t.test(len ~ supp, data=dta)
##
## Welch Two Sample t-test
##
## data: len by supp
## t = 1.9153, df = 55.309, p-value = 0.06063
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.1710156 7.5710156
## sample estimates:
## mean in group OJ mean in group VC
## 20.66333 16.96333
multicon::diffPlot(len ~ supp, data=dta, grp.names=c("VC","OJ"),xlab="Treatment", ylab="Len")

dice <- set.seed("1234")
dice <- sample(3:18, size=9999, replace=T,)
head(dice, 100)
## [1] 14 18 12 8 7 14 17 11 7 8 18 6 4 9 8 12 8 17 16 6 16 16 10 16 6
## [26] 6 7 10 6 10 5 6 17 17 15 12 7 4 16 17 10 13 6 18 14 5 9 11 5 8
## [51] 6 10 18 12 13 4 7 17 8 3 8 10 5 8 3 15 18 3 11 10 12 3 17 13 10
## [76] 12 18 17 8 5 11 18 5 8 11 12 9 8 10 15 11 5 5 4 7 10 12 9 8 14
dice_count <- table(dice)
dice_count
## dice
## 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## 590 639 628 586 658 641 597 645 623 643 630 630 608 612 628 641
hist(dice,freq=T)
