Errors in running code in vignettes:
when running code in 'Ch_analysing_longitudinal_dataI.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> library("lme4")

  When sourcing 'Ch_analysing_longitudinal_dataI.R':
Error: there is no package called 'lme4'
Execution halted
when running code in 'Ch_analysing_longitudinal_dataII.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> options(digits = 3)

> if (!interactive()) {
+     print.summary.gee <- function(x, digits = NULL, quote = FALSE, 
+         prefix = "", ...) {
+         if (is.null(digi .... [TRUNCATED] 

> library("gee")

  When sourcing 'Ch_analysing_longitudinal_dataII.R':
Error: there is no package called 'gee'
Execution halted
when running code in 'Ch_analysis_of_variance.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> library("wordcloud")

  When sourcing 'Ch_analysis_of_variance.R':
Error: there is no package called 'wordcloud'
Execution halted
when running code in 'Ch_bayesian_inference.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> data("Smoking_Mueller1940", package = "HSAUR3")

> toLatex(HSAURtable(Smoking_Mueller1940), caption = paste("Smoking and lung cancer case-control study by M\\\"uller (1940).", 
+     "The smoking int .... [TRUNCATED] 
\index{Smoking\_Mueller1940 data@\Robject{Smoking\_Mueller1940} data}
\begin{center}
\begin{longtable} { rrrr }
\caption{\Robject{Smoking\_Mueller1940} data. Smoking and lung cancer case-control study by M\"uller (1940). The smoking intensities were defined by the number of cigarettes smoked daily: 1-15 (moderate), 16-25 (heavy), 26-35 (very heavy), and more than 35 (extreme). \label{BI-Smoking_Mueller1940-tab}}
\\
 & & \multicolumn{ 2 }{c}{\Robject{ Diagnosis }} \\
\Robject{ Smoking } &   & Lung cancer & Healthy control \\
  & Nonsmoker & 3 & 14 \\
  & Moderate smoker & 27 & 41 \\
  & Heavy smoker & 13 & 22 \\
  & Very heavy smoker & 18 & 5 \\
  & Extreme smoker & 25 & 4 \\
\end{longtable}
\end{center}

> x <- as.table(Smoking_SchairerSchoeniger1944[, c("Lung cancer", 
+     "Healthy control")])

> toLatex(HSAURtable(x, xname = "Smoking_SchairerSchoeniger1944"), 
+     caption = paste("Smoking and lung cancer case-control study by Schairer and  ..." ... [TRUNCATED] 
\index{Smoking\_SchairerSchoeniger1944 data@\Robject{Smoking\_SchairerSchoeniger1944} data}
\begin{center}
\begin{longtable} { rrrr }
\caption{\Robject{Smoking\_SchairerSchoeniger1944} data. Smoking and lung cancer case-control study by Schairer and Sch\"oniger (1944). Cancer other than lung cancer omitted. The smoking intensities were defined by the number of cigarettes smoked daily: 1-5 (moderate), 6-10 (medium), 11-20 (heavy), and more than 20 (very heavy). \label{BI-Smoking_SchairerSchoeniger1944-tab}}
\\
 & & \multicolumn{ 2 }{c}{\Robject{ Diagnosis }} \\
\Robject{ Smoking } &   & Lung cancer & Healthy control \\
  & Nonsmoker & 3 & 43 \\
  & Moderate smoker & 11 & 98 \\
  & Medium smoker & 31 & 57 \\
  & Heavy smoker & 19 & 47 \\
  & Very heavy smoker & 29 & 25 \\
\end{longtable}
\end{center}

> data("Smoking_Wassink1945", package = "HSAUR3")

> toLatex(HSAURtable(Smoking_Wassink1945), caption = paste("Smoking and lung cancer case-control study by Wassink (1945).", 
+     "Smoking categories ..." ... [TRUNCATED] 
\index{Smoking\_Wassink1945 data@\Robject{Smoking\_Wassink1945} data}
\begin{center}
\begin{longtable} { rrrr }
\caption{\Robject{Smoking\_Wassink1945} data. Smoking and lung cancer case-control study by Wassink (1945). Smoking categories correspond to the categories used by M\"uller (1940). \label{BI-Smoking_Wassink1945-tab}}
\\
 & & \multicolumn{ 2 }{c}{\Robject{ Diagnosis }} \\
\Robject{ Smoking } &   & Lung cancer & Healthy control \\
  & Nonsmoker & 6 & 19 \\
  & Moderate smoker & 18 & 36 \\
  & Heavy smoker & 36 & 25 \\
  & Very heavy smoker & 74 & 20 \\
\end{longtable}
\end{center}

> data("Smoking_DollHill1950", package = "HSAUR3")

> x <- as.table(Smoking_DollHill1950[, , "Male", drop = FALSE])

> toLatex(HSAURtable(x, xname = "Smoking_DollHill1950"), 
+     caption = paste("Smoking and lung cancer case-control study (only males) by Doll and H ..." ... [TRUNCATED] 
\index{Smoking\_DollHill1950 data@\Robject{Smoking\_DollHill1950} data}
\begin{center}
\begin{longtable} { rrrr }
\caption{\Robject{Smoking\_DollHill1950} data. Smoking and lung cancer case-control study (only males) by Doll and Hill (1950). The labels for the smoking categories give the number of cigarettes smoked every day. \label{BI-Smoking_DollHill1950-tab}}
\\
 & & \multicolumn{ 2 }{c}{\Robject{ Diagnosis }} \\
\Robject{ Smoking } &   & Lung cancer & Other \\
  & Nonsmoker & 2 & 27 \\
  & 1- & 33 & 55 \\
  & 5- & 250 & 293 \\
  & 15- & 196 & 190 \\
  & 25- & 136 & 71 \\
  & 50+ & 32 & 13 \\
\end{longtable}
\end{center}

> library("coin")

  When sourcing 'Ch_bayesian_inference.R':
Error: there is no package called 'coin'
Execution halted
when running code in 'Ch_cluster_analysis.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> library("mclust")

  When sourcing 'Ch_cluster_analysis.R':
Error: there is no package called 'mclust'
Execution halted
when running code in 'Ch_conditional_inference.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> data("roomwidth", package = "HSAUR3")

> nobs <- table(roomwidth$unit)

> ties <- tapply(roomwidth$width, roomwidth$unit, function(x) length(x) - 
+     length(unique(x)))

> library("coin")

  When sourcing 'Ch_conditional_inference.R':
Error: there is no package called 'coin'
Execution halted
when running code in 'Ch_density_estimation.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> x <- library("KernSmooth")
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009

> x <- library("flexmix")

  When sourcing 'Ch_density_estimation.R':
Error: there is no package called 'flexmix'
Execution halted
when running code in 'Ch_gam.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> library("mgcv")
Loading required package: nlme
This is mgcv 1.8-39. For overview type 'help("mgcv-package")'.

> library("mboost")

  When sourcing 'Ch_gam.R':
Error: there is no package called 'mboost'
Execution halted
when running code in 'Ch_graphical_display.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> xr <- range(USmelanoma$mortality) * c(0.9, 1.1)

> xr
[1]  77.4 251.9

> layout(matrix(1:2, nrow = 2))

> par(mar = par("mar") * c(0.8, 1, 1, 1))

> boxplot(USmelanoma$mortality, ylim = xr, horizontal = TRUE, 
+     xlab = "Mortality")

> hist(USmelanoma$mortality, xlim = xr, xlab = "", main = "", 
+     axes = FALSE, ylab = "")

> axis(1)

> plot(mortality ~ ocean, data = USmelanoma, xlab = "Contiguity to an ocean", 
+     ylab = "Mortality")

> dyes <- with(USmelanoma, density(mortality[ocean == 
+     "yes"]))

> dno <- with(USmelanoma, density(mortality[ocean == 
+     "no"]))

> plot(dyes, lty = 1, xlim = xr, main = "", ylim = c(0, 
+     0.018), xlab = "Mortality")

> lines(dno, lty = 2)

> legend("topleft", lty = 1:2, legend = c("Coastal State", 
+     "Land State"), bty = "n")

> layout(matrix(1:2, ncol = 2))

> plot(mortality ~ longitude, data = USmelanoma, ylab = "Mortality", 
+     xlab = "Longitude")

> plot(mortality ~ latitude, data = USmelanoma, ylab = "Mortality", 
+     xlab = "Latitude")

> plot(mortality ~ latitude, data = USmelanoma, pch = (1:2)[ocean], 
+     ylab = "Mortality", xlab = "Latitude")

> legend("topright", legend = c("Land state", "Coast state"), 
+     pch = 1:2, bty = "n")

> subset(USmelanoma, latitude < 32)
          mortality latitude longitude ocean
Florida         197     28.0      82.0   yes
Louisiana       190     31.2      91.8   yes
Texas           229     31.5      98.0   yes

> library("sp")

  When sourcing 'Ch_graphical_display.R':
Error: there is no package called 'sp'
Execution halted
when running code in 'Ch_introduction_to_R.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> HSAUR3:::Rwelcome()
R : Copyright 2022 The R Foundation for Statistical Computing
Version 4.3.0 (2022-03-26), ISBN 3-900051-07-0
 
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
 
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
 
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
> options(prompt = "> ")

> options(prompt = "R> ")

> x <- sqrt(25) + 2

> x
[1] 7

> print(x)
[1] 7

> colwidth <- 4

> ip <- installed.packages(priority = "high")

> pkgs <- unique(ip[, "Package"])

> pkgs <- paste("\\Rpackage{", pkgs, "}", sep = "")

> nrows <- ceiling(length(pkgs)/colwidth)

> pkgs <- c(pkgs, rep("", colwidth * nrows - length(pkgs)))

> cat(paste(c("\\begin{tabular}{", paste(rep("l", colwidth), 
+     collapse = ""), "}"), collapse = ""), "\n", file = "tables/rec.tex", 
+     append .... [TRUNCATED] 

> for (i in 1:nrows) {
+     cat(paste(pkgs[(1:colwidth) + (i - 1) * colwidth], collapse = " & "), 
+         file = "tables/rec.tex", append = TRUE)
 .... [TRUNCATED] 

> cat("\\end{tabular}\n", file = "tables/rec.tex", append = TRUE)

> rm(ip, nrows)

> cp <- available.packages(contriburl = "http://CRAN.r-project.org/src/contrib")

> ncp <- sum(!rownames(cp) %in% pkgs)

> rm(cp, pkgs)

> rm(ncp, colwidth, i)

> data("Forbes2000", package = "HSAUR3")

> ls()
[1] "Forbes2000" "a"          "book"       "ch"        
[5] "refs"       "s"          "x"         

> x <- c("x", "Forbes2000")

> print(x)
[1] "x"          "Forbes2000"

> print(Forbes2000[1:3, ])
  rank                name       country      category  sales
1    1           Citigroup United States       Banking  94.71
2    2    General Electric United States Conglomerates 134.19
3    3 American Intl Group United States     Insurance  76.66
  profits  assets marketvalue
1   17.85 1264.03      255.30
2   15.59  626.93      328.54
3    6.46  647.66      194.87

> cat("...\n")
...

> str(Forbes2000, vec.len = 2, strict.width = "cut", 
+     width = 60)
'data.frame':	2000 obs. of  8 variables:
 $ rank       : int  1 2 3 4 5 ...
 $ name       : chr  "Citigroup" "General Electric" ...
 $ country    : Factor w/ 61 levels "Africa","Australia",...
 $ category   : Factor w/ 27 levels "Aerospace & defense",..
 $ sales      : num  94.7 134.2 ...
 $ profits    : num  17.9 15.6 ...
 $ assets     : num  1264 627 ...
 $ marketvalue: num  255 329 ...

> class(Forbes2000)
[1] "data.frame"

> dim(Forbes2000)
[1] 2000    8

> nrow(Forbes2000)
[1] 2000

> ncol(Forbes2000)
[1] 8

> names(Forbes2000)
[1] "rank"        "name"        "country"     "category"   
[5] "sales"       "profits"     "assets"      "marketvalue"

> class(Forbes2000[, "rank"])
[1] "integer"

> length(Forbes2000[, "rank"])
[1] 2000

> 1:3
[1] 1 2 3

> c(1, 2, 3)
[1] 1 2 3

> seq(from = 1, to = 3, by = 1)
[1] 1 2 3

> class(Forbes2000[, "name"])
[1] "character"

> length(Forbes2000[, "name"])
[1] 2000

> Forbes2000[, "name"][1]
[1] "Citigroup"

> class(Forbes2000[, "category"])
[1] "factor"

> nlevels(Forbes2000[, "category"])
[1] 27

> levels(Forbes2000[, "category"])[1:3]
[1] "Aerospace & defense"         
[2] "Banking"                     
[3] "Business services & supplies"

> cat("...\n")
...

> table(Forbes2000[, "category"])[1:3]

         Aerospace & defense                      Banking 
                          19                          313 
Business services & supplies 
                          70 

> cat("...\n")
...

> class(Forbes2000[, "sales"])
[1] "numeric"

> median(Forbes2000[, "sales"])
[1] 4.365

> mean(Forbes2000[, "sales"])
[1] 9.69701

> range(Forbes2000[, "sales"])
[1]   0.01 256.33

> summary(Forbes2000[, "sales"])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.010   2.018   4.365   9.697   9.547 256.330 

> pkgpath <- system.file(package = "HSAUR2")

> mywd <- getwd()

> filep <- file.path(pkgpath, "rawdata")

> setwd(filep)

  When sourcing 'Ch_introduction_to_R.R':
Error: cannot change working directory
Execution halted
when running code in 'Ch_logistic_regression_glm.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> data("plasma", package = "HSAUR3")

> layout(matrix(1:2, ncol = 2))

> cdplot(ESR ~ fibrinogen, data = plasma)

> cdplot(ESR ~ globulin, data = plasma)

> plasma_glm_1 <- glm(ESR ~ fibrinogen, data = plasma, 
+     family = binomial())

> summary(plasma_glm_1)

Call:
glm(formula = ESR ~ fibrinogen, family = binomial(), data = plasma)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.9298  -0.5399  -0.4382  -0.3356   2.4794  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)
(Intercept)  -6.8451     2.7703  -2.471   0.0135
fibrinogen    1.8271     0.9009   2.028   0.0425

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 30.885  on 31  degrees of freedom
Residual deviance: 24.840  on 30  degrees of freedom
AIC: 28.84

Number of Fisher Scoring iterations: 5


> ci <- confint(plasma_glm_1)["fibrinogen", ]
Waiting for profiling to be done...

> confint(plasma_glm_1, parm = "fibrinogen")
Waiting for profiling to be done...
    2.5 %    97.5 % 
0.3387619 3.9984921 

> print(ci)
    2.5 %    97.5 % 
0.3387619 3.9984921 

> exp(coef(plasma_glm_1)["fibrinogen"])
fibrinogen 
  6.215715 

> ci <- exp(confint(plasma_glm_1, parm = "fibrinogen"))
Waiting for profiling to be done...

> exp(confint(plasma_glm_1, parm = "fibrinogen"))
Waiting for profiling to be done...
    2.5 %    97.5 % 
 1.403209 54.515884 

> print(ci)
    2.5 %    97.5 % 
 1.403209 54.515884 

> plasma_glm_2 <- glm(ESR ~ fibrinogen + globulin, data = plasma, 
+     family = binomial())

> summary(plasma_glm_2)

Call:
glm(formula = ESR ~ fibrinogen + globulin, family = binomial(), 
    data = plasma)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.9683  -0.6122  -0.3458  -0.2116   2.2636  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)
(Intercept) -12.7921     5.7963  -2.207   0.0273
fibrinogen    1.9104     0.9710   1.967   0.0491
globulin      0.1558     0.1195   1.303   0.1925

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 30.885  on 31  degrees of freedom
Residual deviance: 22.971  on 29  degrees of freedom
AIC: 28.971

Number of Fisher Scoring iterations: 5


> plasma_anova <- anova(plasma_glm_1, plasma_glm_2, 
+     test = "Chisq")

> anova(plasma_glm_1, plasma_glm_2, test = "Chisq")
Analysis of Deviance Table

Model 1: ESR ~ fibrinogen
Model 2: ESR ~ fibrinogen + globulin
  Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1        30     24.840                     
2        29     22.971  1   1.8692   0.1716

> prob <- predict(plasma_glm_2, type = "response")

> plot(globulin ~ fibrinogen, data = plasma, xlim = c(2, 
+     6), ylim = c(25, 55), pch = ".")

> symbols(plasma$fibrinogen, plasma$globulin, circles = prob, 
+     add = TRUE)

> data("womensrole", package = "HSAUR3")

> fm1 <- cbind(agree, disagree) ~ gender + education

> womensrole_glm_1 <- glm(fm1, data = womensrole, family = binomial())

> summary(womensrole_glm_1)

Call:
glm(formula = fm1, family = binomial(), data = womensrole)

Deviance Residuals: 
     Min        1Q    Median        3Q       Max  
-2.72544  -0.86302  -0.06525   0.84340   3.13315  

Coefficients:
             Estimate Std. Error z value Pr(>|z|)
(Intercept)   2.50937    0.18389  13.646   <2e-16
genderFemale -0.01145    0.08415  -0.136    0.892
education    -0.27062    0.01541 -17.560   <2e-16

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 451.722  on 40  degrees of freedom
Residual deviance:  64.007  on 38  degrees of freedom
AIC: 208.07

Number of Fisher Scoring iterations: 4


> role.fitted1 <- predict(womensrole_glm_1, type = "response")

> myplot <- function(role.fitted) {
+     f <- womensrole$gender == "Female"
+     plot(womensrole$education, role.fitted, type = "n", ylab = "Probabi ..." ... [TRUNCATED] 

> myplot(role.fitted1)

> fm2 <- cbind(agree, disagree) ~ gender * education

> womensrole_glm_2 <- glm(fm2, data = womensrole, family = binomial())

> summary(womensrole_glm_2)

Call:
glm(formula = fm2, family = binomial(), data = womensrole)

Deviance Residuals: 
     Min        1Q    Median        3Q       Max  
-2.39097  -0.88062   0.01532   0.72783   2.45262  

Coefficients:
                       Estimate Std. Error z value Pr(>|z|)
(Intercept)             2.09820    0.23550   8.910  < 2e-16
genderFemale            0.90474    0.36007   2.513  0.01198
education              -0.23403    0.02019 -11.592  < 2e-16
genderFemale:education -0.08138    0.03109  -2.617  0.00886

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 451.722  on 40  degrees of freedom
Residual deviance:  57.103  on 37  degrees of freedom
AIC: 203.16

Number of Fisher Scoring iterations: 4


> role.fitted2 <- predict(womensrole_glm_2, type = "response")

> myplot(role.fitted2)

> res <- residuals(womensrole_glm_2, type = "deviance")

> plot(predict(womensrole_glm_2), res, xlab = "Fitted values", 
+     ylab = "Residuals", ylim = max(abs(res)) * c(-1, 1))

> abline(h = 0, lty = 2)

> data("polyps", package = "HSAUR3")

> polyps_glm_1 <- glm(number ~ treat + age, data = polyps, 
+     family = poisson())

> summary(polyps_glm_1)

Call:
glm(formula = number ~ treat + age, family = poisson(), data = polyps)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-4.2212  -3.0536  -0.1802   1.4459   5.8301  

Coefficients:
             Estimate Std. Error z value Pr(>|z|)
(Intercept)  4.529024   0.146872   30.84  < 2e-16
treatdrug   -1.359083   0.117643  -11.55  < 2e-16
age         -0.038830   0.005955   -6.52 7.02e-11

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 378.66  on 19  degrees of freedom
Residual deviance: 179.54  on 17  degrees of freedom
AIC: 273.88

Number of Fisher Scoring iterations: 5


> polyps_glm_2 <- glm(number ~ treat + age, data = polyps, 
+     family = quasipoisson())

> summary(polyps_glm_2)

Call:
glm(formula = number ~ treat + age, family = quasipoisson(), 
    data = polyps)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-4.2212  -3.0536  -0.1802   1.4459   5.8301  

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)  4.52902    0.48106   9.415 3.72e-08
treatdrug   -1.35908    0.38533  -3.527  0.00259
age         -0.03883    0.01951  -1.991  0.06284

(Dispersion parameter for quasipoisson family taken to be 10.72805)

    Null deviance: 378.66  on 19  degrees of freedom
Residual deviance: 179.54  on 17  degrees of freedom
AIC: NA

Number of Fisher Scoring iterations: 5


> library("survival")

> backpain_glm <- clogit(I(status == "case") ~ driver + 
+     suburban + strata(ID), data = backpain)

> print(backpain_glm)
Call:
clogit(I(status == "case") ~ driver + suburban + strata(ID), 
    data = backpain)

              coef exp(coef) se(coef)     z      p
driveryes   0.6579    1.9307   0.2940 2.238 0.0252
suburbanyes 0.2555    1.2911   0.2258 1.131 0.2580

Likelihood ratio test=9.55  on 2 df, p=0.008457
n= 434, number of events= 217 

> library("MASS")

> opts <- options(contrasts = c("contr.treatment", "contr.helmert"))

> CHFLS_polr <- polr(R_happy ~ ., data = CHFLS, Hess = TRUE)

> options(opts)

> summary(CHFLS_polr)
Call:
polr(formula = R_happy ~ ., data = CHFLS, Hess = TRUE)

Coefficients:
                          Value Std. Error t value
R_regionCoastal East -1.704e-01  1.228e-01 -1.3874
R_regionInlands      -4.626e-01  1.490e-01 -3.1048
R_regionNorth        -2.104e-01  1.321e-01 -1.5928
R_regionNortheast    -5.856e-01  1.273e-01 -4.6017
R_regionCentral West -6.656e-01  1.353e-01 -4.9192
R_age                 1.524e-02  6.262e-03  2.4341
R_edu1                2.985e-02  1.436e-01  0.2078
R_edu2               -6.423e-02  6.188e-02 -1.0380
R_edu3                2.627e-02  4.118e-02  0.6379
R_edu4                7.590e-03  4.850e-02  0.1565
R_edu5               -1.440e-02  6.563e-02 -0.2195
R_income              1.004e-04  1.080e-04  0.9302
R_health1             5.748e-01  2.408e-02 23.8705
R_health2             5.322e-01  6.194e-02  8.5924
R_health3             4.268e-01  3.791e-02 11.2576
R_health4             5.313e-01  3.227e-02 16.4610
R_height              2.457e-02  9.960e-03  2.4672
A_height             -9.432e-03  9.351e-03 -1.0086
A_edu1               -4.529e-01  2.243e-01 -2.0191
A_edu2               -8.668e-02  8.530e-02 -1.0162
A_edu3               -3.800e-02  5.016e-02 -0.7576
A_edu4               -1.652e-02  4.820e-02 -0.3428
A_edu5               -1.626e-02  4.788e-02 -0.3395
A_income              7.853e-05  7.442e-05  1.0552

Intercepts:
                             Value     Std. Error t value  
Very unhappy|Not too happy     -1.8475    0.0024  -770.7856
Not too happy|Somewhat happy    1.0787    0.2632     4.0977
Somewhat happy|Very happy       5.0506    0.2854    17.6963

Residual Deviance: 2375.246 
AIC: 2429.246 
(3 observations deleted due to missingness)

> H <- with(CHFLS, contr.helmert(table(R_health)))

> rownames(H) <- levels(CHFLS$R_health)

> colnames(H) <- paste(levels(CHFLS$R_health)[-1], "- avg")

> H
          Not good - avg Fair - avg Good - avg Excellent - avg
Poor                  -1         -1         -1              -1
Not good               1         -1         -1              -1
Fair                   0          2         -1              -1
Good                   0          0          3              -1
Excellent              0          0          0               4

> library("multcomp")

  When sourcing 'Ch_logistic_regression_glm.R':
Error: there is no package called 'multcomp'
Execution halted
when running code in 'Ch_meta_analysis.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> data("smoking", package = "HSAUR3")

> odds <- function(x) (x[1] * (x[4] - x[3]))/((x[2] - 
+     x[1]) * x[3])

> weight <- function(x) ((x[2] - x[1]) * x[3])/sum(x)

> W <- apply(smoking, 1, weight)

> Y <- apply(smoking, 1, odds)

> sum(W * Y)/sum(W)
[1] 1.664159

> library("rmeta")

  When sourcing 'Ch_meta_analysis.R':
Error: there is no package called 'rmeta'
Execution halted
when running code in 'Ch_missing_values.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> data("bp", package = "HSAUR3")

> toLatex(HSAURtable(bp), pcol = 2, caption = paste("Blood pressure data."), 
+     label = "MV-bp-tab")
\index{bp data@\Robject{bp} data}
\begin{center}
\begin{longtable}{ rrr|rrr }
\caption{\Robject{bp} data. Blood pressure data. \label{MV-bp-tab}}
\\
\hline
\Robject{logdose} & \Robject{bloodp} & \Robject{recovtime} & \Robject{logdose} & \Robject{bloodp} & \Robject{recovtime} \\ \hline
\endfirsthead
\caption[]{\Robject{bp} data (continued).} \\
\hline
\Robject{logdose} & \Robject{bloodp} & \Robject{recovtime} & \Robject{logdose} & \Robject{bloodp} & \Robject{recovtime} \\ \hline
\endhead
2.26 & 66 & 7 & 2.70 & 73 & 39 \\
1.81 & 52 & 10 & 1.90 & 56 & 28 \\
1.78 & 72 & 18 & 2.78 & 83 & 12 \\
1.54 & 67 & NA & 2.27 & 67 & 60 \\
2.06 & 69 & 10 & 1.74 & 84 & 10 \\
1.74 & 71 & 13 & 2.62 & 68 & NA \\
2.56 & 88 & 21 & 1.80 & 64 & 22 \\
2.29 & 68 & 12 & 1.81 & 60 & 21 \\
1.80 & 59 & 9 & 1.58 & 62 & 14 \\
2.32 & 73 & NA & 2.41 & 76 & 4 \\
2.04 & 68 & 20 & 1.65 & 60 & 27 \\
1.88 & 58 & 31 & 2.24 & 60 & 26 \\
1.18 & 61 & 23 & 1.70 & 59 & NA \\
2.08 & 68 & 22 & 2.45 & 84 & 15 \\
1.70 & 69 & 13 & 1.72 & 66 & 8 \\
1.74 & 55 & 9 & 2.37 & 68 & 46 \\
1.90 & 67 & 50 & 2.23 & 65 & 24 \\
1.79 & 67 & NA & 1.92 & 69 & NA \\
2.11 & 68 & 11 & 1.99 & 72 & 25 \\
1.72 & 59 & 8 & 1.99 & 63 & 45 \\
1.74 & 68 & NA & 2.35 & 56 & 72 \\
1.60 & 63 & 16 & 1.80 & 70 & 25 \\
2.15 & 65 & 23 & 2.36 & 69 & 28 \\
2.26 & 72 & 7 & 1.59 & 60 & 10 \\
1.65 & 58 & NA & 2.10 & 51 & 25 \\
1.63 & 69 & NA & 1.80 & 61 & 44 \\
2.40 & 70 & NA &   &   &   \\
\hline
\end{longtable}
\end{center}

> sapply(bp, function(x) sum(is.na(x)))
  logdose    bloodp recovtime 
        0         0        10 

> summary(bp$recovtime, na.rm = TRUE)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
    4.0    10.5    21.0    22.4    26.5    72.0      10 

> sd(bp$recovtime, na.rm = TRUE)
[1] 15.08727

> with(bp, cor(bloodp, recovtime, use = "complete.obs"))
[1] -0.1888398

> with(bp, cor(logdose, recovtime, use = "complete.obs"))
[1] 0.2103542

> layout(matrix(1:3, nrow = 1))

> plot(bloodp ~ logdose, data = bp)

> plot(recovtime ~ bloodp, data = bp)

> plot(recovtime ~ logdose, data = bp)

> summary(lm(recovtime ~ bloodp + logdose, data = bp))

Call:
lm(formula = recovtime ~ bloodp + logdose, data = bp)

Residuals:
    Min      1Q  Median      3Q     Max 
-20.057 -10.487  -1.770   5.924  36.462 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)  32.3099    18.4140   1.755   0.0870
bloodp       -0.6882     0.3014  -2.283   0.0278
logdose      17.7734     7.4974   2.371   0.0227

Residual standard error: 14.22 on 40 degrees of freedom
  (10 observations deleted due to missingness)
Multiple R-squared:  0.1545,	Adjusted R-squared:  0.1122 
F-statistic: 3.653 on 2 and 40 DF,  p-value: 0.03489


> library("mice")

  When sourcing 'Ch_missing_values.R':
Error: there is no package called 'mice'
Execution halted
when running code in 'Ch_multidimensional_scaling.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> x <- library("ape")

  When sourcing 'Ch_multidimensional_scaling.R':
Error: there is no package called 'ape'
Execution halted
when running code in 'Ch_multiple_linear_regression.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> library("wordcloud")

  When sourcing 'Ch_multiple_linear_regression.R':
Error: there is no package called 'wordcloud'
Execution halted
when running code in 'Ch_quantile_regression.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> library("lattice")

> trellis.par.set(list(plot.symbol = list(col = 1, pch = 20, 
+     cex = 0.7), box.rectangle = list(col = 1), plot.line = list(col = 1, 
+     lwd =  .... [TRUNCATED] 
Warning in trellis.par.set(list(plot.symbol = list(col = 1, pch = 20, cex = 0.7),  :
  Note: The default device has been opened to honour attempt to modify trellis settings

> ltheme <- canonical.theme(color = FALSE)

> ltheme$strip.background$col <- "transparent"

> lattice.options(default.theme = ltheme)

> data("db", package = "gamlss.data")

  When sourcing 'Ch_quantile_regression.R':
Error: there is no package called 'gamlss.data'
Execution halted
when running code in 'Ch_recursive_partitioning.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> library("vcd")

  When sourcing 'Ch_recursive_partitioning.R':
Error: there is no package called 'vcd'
Execution halted
when running code in 'Ch_simple_inference.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> library("vcd")

  When sourcing 'Ch_simple_inference.R':
Error: there is no package called 'vcd'
Execution halted
when running code in 'Ch_simultaneous_inference.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> library("multcomp")

  When sourcing 'Ch_simultaneous_inference.R':
Error: there is no package called 'multcomp'
Execution halted
when running code in 'Ch_survival_analysis.Rnw'

> rm(list = ls())

> s <- search()[-1]

> s <- s[-match(c("package:base", "package:stats", "package:graphics", 
+     "package:grDevices", "package:utils", "package:datasets", 
+     "packag ..." ... [TRUNCATED] 

> if (length(s) > 0) sapply(s, detach, character.only = TRUE)

> if (!file.exists("tables")) dir.create("tables")

> if (!file.exists("figures")) dir.create("figures")

> set.seed(290875)

> options(prompt = "R> ", continue = "+  ", width = 63, 
+     show.signif.stars = FALSE, SweaveHooks = list(leftpar = function() par(mai = par("mai") .... [TRUNCATED] 

> HSAURpkg <- require("HSAUR3")
Loading required package: HSAUR3
Loading required package: tools

> if (!HSAURpkg) stop("cannot load package ", sQuote("HSAUR3"))

> rm(HSAURpkg)

> a <- Sys.setlocale("LC_ALL", "C")

> book <- TRUE

> refs <- cbind(c("AItR", "DAGD", "SI", "CI", "ANOVA", 
+     "MLR", "GLM", "DE", "RP", "GAM", "SA", "ALDI", "ALDII", "SIMC", 
+     "MA", "PCA", "MDS ..." ... [TRUNCATED] 

> ch <- function(x) {
+     ch <- refs[which(refs[, 1] == x), ]
+     if (book) {
+         return(paste("Chapter~\\\\ref{", ch[1], "}", sep = ""))
+  .... [TRUNCATED] 

> if (file.exists("deparse.R")) source("deparse.R")

> setHook(packageEvent("lattice", "attach"), function(...) {
+     lattice.options(default.theme = function() standard.theme("pdf", 
+         color = .... [TRUNCATED] 

> book <- FALSE

> x <- library("survival")

> x <- library("coin")

  When sourcing 'Ch_survival_analysis.R':
Error: there is no package called 'coin'
Execution halted

  'Ch_analysing_longitudinal_dataI.Rnw' using 'UTF-8'... failed
  'Ch_analysing_longitudinal_dataII.Rnw' using 'UTF-8'... failed
  'Ch_analysis_of_variance.Rnw' using 'UTF-8'... failed
  'Ch_bayesian_inference.Rnw' using 'UTF-8'... failed
  'Ch_cluster_analysis.Rnw' using 'UTF-8'... failed
  'Ch_conditional_inference.Rnw' using 'UTF-8'... failed
  'Ch_density_estimation.Rnw' using 'UTF-8'... failed
  'Ch_errata.Rnw' using 'UTF-8'... OK
  'Ch_gam.Rnw' using 'UTF-8'... failed
  'Ch_graphical_display.Rnw' using 'UTF-8'... failed
  'Ch_introduction_to_R.Rnw' using 'UTF-8'... failed
  'Ch_logistic_regression_glm.Rnw' using 'UTF-8'... failed
  'Ch_meta_analysis.Rnw' using 'UTF-8'... failed
  'Ch_missing_values.Rnw' using 'UTF-8'... failed
  'Ch_multidimensional_scaling.Rnw' using 'UTF-8'... failed
  'Ch_multiple_linear_regression.Rnw' using 'UTF-8'... failed
  'Ch_principal_components_analysis.Rnw' using 'UTF-8'... OK
  'Ch_quantile_regression.Rnw' using 'UTF-8'... failed
  'Ch_recursive_partitioning.Rnw' using 'UTF-8'... failed
  'Ch_simple_inference.Rnw' using 'UTF-8'... failed
  'Ch_simultaneous_inference.Rnw' using 'UTF-8'... failed
  'Ch_survival_analysis.Rnw' using 'UTF-8'... failed