Running examples in ‘DanielBiostatistics10th-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: Chapter08
> ### Title: Chapter 8: Analysis of Variance
> ### Aliases: Chapter08
> 
> ### ** Examples
> 
> library(DanielBiostatistics10th)
> 
> # Example 8.2.1; Page 318 (10th ed), Page 280 (11th ed)
> head(EXA_C08_S02_01)
  selenium type
1    26.72  VEN
2    28.58  VEN
3    29.71  VEN
4    26.95  VEN
5    10.97  VEN
6    21.97  VEN
> boxplot(selenium ~ type, data = EXA_C08_S02_01, main = 'Figure 8.2.7')
> (aov_d821 = aov(selenium ~ type, data = EXA_C08_S02_01)) 
Call:
   aov(formula = selenium ~ type, data = EXA_C08_S02_01)

Terms:
                    type Residuals
Sum of Squares  21261.83  36747.23
Deg. of Freedom        3       140

Residual standard error: 16.20124
Estimated effects may be unbalanced
> # ?stats::aov # analysis-of-variance model
> anova(aov_d821) 
Analysis of Variance Table

Response: selenium
           Df Sum Sq Mean Sq F value    Pr(>F)    
type        3  21262  7087.3  27.001 7.684e-14 ***
Residuals 140  36747   262.5                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> # ?stats::anova # ANOVA table
> 
> # Example 8.2.2; Page 325 (10th ed), Page 286 (11th ed)
> (tukey_d822 <- TukeyHSD(aov_d821, conf.level = 0.95)) # Figure 8.2.8
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = selenium ~ type, data = EXA_C08_S02_01)

$type
              diff        lwr        upr     p adj
RRB-NRB -32.963297 -44.227468 -21.699125 0.0000000
SQU-NRB -18.800649 -31.151826  -6.449472 0.0006857
VEN-NRB -36.170840 -47.817763 -24.523916 0.0000000
SQU-RRB  14.162648   4.537925  23.787371 0.0011105
VEN-RRB  -3.207543 -11.910101   5.495016 0.7732308
VEN-SQU -17.370190 -27.440173  -7.300208 0.0000881

> plot(tukey_d822)
> 
> # Example 8.3.1; Page 339 (10th ed), Page 298 (11th ed)
> head(EXA_C08_S03_01)
  time method ageGroup
1    7      A        1
2    8      A        2
3    9      A        3
4   10      A        4
5   11      A        5
6    9      B        1
> head(d831 <- within(EXA_C08_S03_01, expr = {
+   ageGroup = structure(ageGroup, levels = c('<20', '20s', '30s', '40s', '>50'), class = 'factor')
+ }))
  time method ageGroup
1    7      A      <20
2    8      A      20s
3    9      A      30s
4   10      A      40s
5   11      A      >50
6    9      B      <20
> (aov_831 = aov(time ~ method + ageGroup, data = d831))
Call:
   aov(formula = time ~ method + ageGroup, data = d831)

Terms:
                   method  ageGroup Residuals
Sum of Squares  18.533333 24.933333  3.466667
Deg. of Freedom         2         4         8

Residual standard error: 0.6582806
Estimated effects may be unbalanced
> anova(aov_831)
Analysis of Variance Table

Response: time
          Df  Sum Sq Mean Sq F value    Pr(>F)    
method     2 18.5333  9.2667  21.385 0.0006165 ***
ageGroup   4 24.9333  6.2333  14.385 0.0010017 ** 
Residuals  8  3.4667  0.4333                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 
> # Example 8.4.1; Page 348 (10th ed), Page 307 (11th ed)
> head(EXA_C08_S04_01)
  FUNC SUBJ TIME
1   80    1    1
2   95    2    1
3   65    3    1
4   50    4    1
5   60    5    1
6   70    6    1
> head(d841 <- within(EXA_C08_S04_01, expr = {
+   SUBJ = factor(SUBJ)
+   TIME = structure(TIME, levels = c('Baseline', '1-Mon', '3-Mon', '6-Mon'), class = 'factor')
+ }))
  FUNC SUBJ     TIME
1   80    1 Baseline
2   95    2 Baseline
3   65    3 Baseline
4   50    4 Baseline
5   60    5 Baseline
6   70    6 Baseline
> (aov_841 = aov(FUNC ~ SUBJ + TIME, data = d841))
Call:
   aov(formula = FUNC ~ SUBJ + TIME, data = d841)

Terms:
                     SUBJ      TIME Residuals
Sum of Squares  20237.500  2395.833  7404.167
Deg. of Freedom        17         3        51

Residual standard error: 12.04906
Estimated effects may be unbalanced
> anova(aov_841)
Analysis of Variance Table

Response: FUNC
          Df  Sum Sq Mean Sq F value    Pr(>F)    
SUBJ      17 20237.5 1190.44  8.1998 2.179e-09 ***
TIME       3  2395.8  798.61  5.5008  0.002371 ** 
Residuals 51  7404.2  145.18                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 
> # Example 8.4.2; Page 352 (10th ed), Page 310 (11th ed)
> # (optional; out of the scope of this course)
> head(EXA_C08_S04_02)
  subject treatment totalC1 totalC2 totalC3 totalC4
1       1         1       6       6       6       7
2       2         1       9       6      10       9
3       3         1       7       9      17      19
4       4         1       6       7       9       3
5       5         1       6       7      16      13
6       6         1       6       6       6      11
> names(EXA_C08_S04_02)[3:6] = c('baseline', '2wk', '4wk', '6wk')
> head(d842a <- within(EXA_C08_S04_02, expr = {
+   subject = factor(subject)
+   treatment = structure(treatment, levels = c('placebo', 'aloe_juice'), class = 'factor')
+ }))
  subject treatment baseline 2wk 4wk 6wk
1       1   placebo        6   6   6   7
2       2   placebo        9   6  10   9
3       3   placebo        7   9  17  19
4       4   placebo        6   7   9   3
5       5   placebo        6   7  16  13
6       6   placebo        6   6   6  11
> head(d842b <- reshape2::melt(d842a, id.vars = c('subject', 'treatment'), 
+                              variable.name = 'time', value.name = 'OralScores'))
Error in loadNamespace(x) : there is no package called ‘reshape2’
Calls: head ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted