forked from PeterKDunn/SRM-Textbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
51-App-Tables.Rmd
109 lines (79 loc) · 3.11 KB
/
51-App-Tables.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Tables {#Tables}
<!-- APPENDIX B: Table -->
<!-- Different forwards-z tables pointers for ONLINE and PDF: -->
<!-- * ONLINE: Only have *one* link to the forward tables -->
<!-- * PDF: Have *two* links to the forward tables: Negative and positive z-values -->
<!-- Different backwards z-table pointers for ONLINE and PDF: -->
<!-- * ONLINE: Point to the backwards-z tables -->
<!-- * PDF: NO pointer, as we just use the forward-tables -->
This Appendix contains tables that may be useful:
* Random numbers (Appendix \@ref(AppendixRandomNumbers)).
* $z$-tables: Find the area associated with a normal distribution **given the $z$-score**
<!-- HTML: One set of tables only is needed -->
<!-- PDF: Two set of tables: NEG and POS z-scores -->
`r if (knitr::is_html_output()){
'(Appendix \\@ref(ZTablesOnline)).'
} else {
'(Appendices \\@ref(ZTablesNEG) and \\@ref(ZTablesPOS)).'
}`
<!-- Only for online: PDF uses forward tables -->
`r if (knitr::is_html_output()){
'* $z$-tables: Find the $z$-score when **given an area under a normal distribution**
(Appendix \\@ref(ZTablesOnlineBackwardsHTML)).'
}`
## Random numbers {#AppendixRandomNumbers}
```{r}
num.rows <- 26
num.cols <- 5
numbers.per.cell <- 5
total.numbers <- num.rows * num.cols * numbers.per.cell
random.numbers <- sample(0:9,
total.numbers,
replace = TRUE)
rn.array <- array(random.numbers,
dim = c(num.rows, num.cols) )
rownames(rn.array) <- paste( "Row",
LETTERS)
colnames(rn.array) <- paste("Column",
c("I","II","III","IV","V") )
for (i in (1 : num.rows)){
for (j in (1 : num.cols)){
rn.array[i,j] <- paste( sample(0:9,
size = numbers.per.cell,
replace = TRUE),
collapse = " " )
}
}
if( knitr::is_latex_output() ) {
knitr::kable(rn.array,
format = "latex",
longtable = FALSE,
caption = "Some random numbers",
booktabs = TRUE) %>%
kable_styling(font_size = 9) %>%
row_spec(0, bold = TRUE)
}
if( knitr::is_html_output() ) {
knitr::kable(rn.array,
format = "html",
longtable = FALSE,
caption = "Some random numbers",
booktabs = TRUE) %>%
row_spec(row = 0,
bold = TRUE)
}
```
<!-- The LaTeX files: Only forwards tables, in two bits (positive z and negative z) -->
```{r, child = if (knitr::is_latex_output()) './Tables/Ztables-LaTeX.Rmd'}
```
<!-- The HTML tables (plus instructions) -->
<!-- Forward (z to Area) tables -->
```{r, child = if (knitr::is_html_output()) './Tables/Ztables-Online.Rmd'}
```
```{r, child = if (knitr::is_html_output()) './Tables/Ztables-Using-Online-Instructions.Rmd'}
```
<!-- The HTML tables also includes backwards (Area to z) tables (NOT LATEX) -->
```{r, child = if (knitr::is_html_output() ) './Tables/Ztables-Backwards-Online.Rmd' }
```
```{r, child = if (knitr::is_html_output() ) './Tables/Ztables-Backwards-Using-Online-Instructions.Rmd'}
```