Skip to content

Commit

Permalink
Fixes to epub3/Tables
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKDunn committed Feb 19, 2022
1 parent 4749255 commit e155a12
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 196 deletions.
2 changes: 1 addition & 1 deletion 01-intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ if( knitr::is_html_output() ) {
longtable = FALSE,
caption = "Comparing qualitative and quantitative research",
booktabs = TRUE)
if ( knitr::is_html_output(excludes = "epub")) {
if ( knitr::is_html_output(excludes = "epub3")) {
column_spec(out,
column = 2,
bold = TRUE) %>%
Expand Down
42 changes: 25 additions & 17 deletions 02-RQs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ if( knitr::is_html_output() ) {
caption = "The three types of RQs",
booktabs = TRUE)
if ( knitr::is_html_output(excludes = "epub")) {
if ( knitr::is_html_output(excludes = "epub3")) {
kable_styling(out,
full_width = FALSE) %>%
row_spec(row = 0,
Expand Down Expand Up @@ -1918,7 +1918,7 @@ if( knitr::is_html_output() ) {
caption = "The relationship between the population and the individuals",
booktabs = TRUE)
if ( knitr::is_html_output(excludes = "epub")) {
if ( knitr::is_html_output(excludes = "epub3")) {
row_spec(out,
2,
bold = TRUE) # Columns headings in bold
Expand Down Expand Up @@ -2092,7 +2092,7 @@ if( knitr::is_html_output() ) {
caption = "Examples of the Outcome and the corresponding Response variable",
booktabs = TRUE)
if ( knitr::is_html_output(excludes = "epub")) {
if ( knitr::is_html_output(excludes = "epub3")) {
row_spec(out, 2, bold = TRUE) # Columns headings in bold
} else {
out
Expand Down Expand Up @@ -2646,7 +2646,7 @@ are called the **units of analysis**.
## Quick review questions {#Chap2-QuickReview}

<!-- ####################### REVIEW QUESTIONS ##################################### -->
```{r, child = if (knitr::is_html_output()) './children/ReviewQuestions/ReviewQuestions-RQs.Rmd'}
```{r, child = if (knitr::is_html_output(excludes = "epub3")) './children/ReviewQuestions/ReviewQuestions-RQs.Rmd'}
```


Expand All @@ -2660,21 +2660,21 @@ Consider this RQ:
> when texting and talking on a mobile phone?
1. What is the *explanatory* variable?
`r if( knitr::is_html_output() ) {longmcq( c(
`r if( knitr::is_html_output(exclude = "epub3")) {longmcq( c(
"The walking speed of the individuals",
"Talking on the phone",
"Texting on the phone",
answer = "The way the mobile phone is being used",
"The average walking speed") )}`
1. What is the *response* variable?
`r if( knitr::is_html_output() ) {longmcq( c(
`r if( knitr::is_html_output(exclude = "epub3") ) {longmcq( c(
answer = "The walking speed of the individuals",
"Talking on the phone",
"Texting on the phone",
"The way the mobile phone is being used",
"The average walking speed") )}`
1. What is the *outcome*?
`r if( knitr::is_html_output() ) {longmcq( c(
`r if( knitr::is_html_output(exclude = "epub3") ) {longmcq( c(
"The walking speed of the individuals",
"Talking on the phone",
"Texting on the phone",
Expand All @@ -2683,11 +2683,11 @@ Consider this RQ:


::: {.progressBox .progress}
`r if (knitr::is_html_output()) {"**Progress:**"}`
`r webexercises::total_correct()`
`r if (knitr::is_html_output(exclude = "epub3")) {"**Progress:**"}`
`r if (knitr::is_html_output(exclude = "epub3")) {'webexercises::total_correct()'}`
:::

`r webexercises::hide()`
`r if (knitr::is_html_output(exclude = "epub3")) {'webexercises::hide()'}`
1. What *individual* people are doing with their phones probably explains their walking speed:
the *explanatory variable* is the way in which the mobile phone is being used.
Notice that 'talking on the phone' and 'texting on the phone' are not *variables*.
Expand All @@ -2700,7 +2700,7 @@ Consider this RQ:
1. The *outcome* is how the response *variable* is summarised over a group of individuals.
The waling speeds from many individuals could be summarised numerically
using the *average walking speed*, which would be the outcome.
`r webexercises::unhide()`
`r if (knitr::is_html_output(exclude = "epub3")) {'webexercises::unhide()'}`



Expand Down Expand Up @@ -2746,7 +2746,8 @@ WaterDef[, 2] <- c("Rainwater from a rainwater collection tank on your property"
"Highly purified wastewater deemed by scientists as safe for human consumption",
"Highly purified seawater deemed by scientists and public health officials as safe for human consumption."
)
colnames(WaterDef) <- c("Term", "Definition")
colnames(WaterDef) <- c("Term",
"Definition")
WaterDef2 <- WaterDef
set.seed(9876)
WaterDef2[, 2] <- WaterDef2[sample(1:5), 2]
Expand All @@ -2755,20 +2756,27 @@ if( knitr::is_latex_output() ) {
kable(WaterDef2,
format = "latex",
longtable = FALSE,
caption = "Match the term with the operational definition",
booktabs = TRUE) %>%
caption = "Match the term with the operational definition",
booktabs = TRUE) %>%
kable_styling(full_width = FALSE, font_size = 10) %>%
column_spec(column = 1, width = "25mm") %>%
column_spec(column = 2, width = "120mm")
}
if( knitr::is_html_output() ) {
if( knitr::is_html_output(excludes = "epub3") ) {
kable(WaterDef2,
format = "html",
longtable = FALSE,
caption = "Match the term with the operational definition",
booktabs = TRUE) #%>%
# kable_styling(full_width = FALSE, font_size = 9)
booktabs = TRUE)
}
if( knitr::pandoc_to("epub3") ) {
kable(WaterDef2,
format = "html",
longtable = FALSE,
caption = "Match the term with the operational definition",
booktabs = TRUE) %>%
kable_styling(full_width = FALSE, font_size = 10)
}
```

Expand Down
31 changes: 18 additions & 13 deletions 40-App-Tables.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ 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
`r if (knitr::is_html_output()){
`r if (knitr::is_html_output(exclude = "epub3")){
'(Appendix \\@ref(ZTablesOnline)).'
} else {
'(Appendices \\@ref(ZTablesNEG) and \\@ref(ZTablesPOS)).'
}`
`r if (knitr::is_html_output()){
`r if (knitr::is_html_output(exclude = "epub3")){
'* $z$-tables: Find the $z$-score when an area under a normal distribution is known
(Appendix \\@ref(ZTablesOnlineBackwards)).'
}`
Expand Down Expand Up @@ -64,7 +64,7 @@ if( knitr::is_html_output() ) {
longtable = FALSE,
caption = "Some random numbers",
booktabs = TRUE)
if ( knitr::is_html_output(excludes = "epub")) {
if ( knitr::is_html_output(excludes = "epub3")) {
row_spec(out,
row = 0,
bold = TRUE)
Expand All @@ -86,35 +86,40 @@ if( knitr::is_html_output() ) {



```{r, child = if (knitr::is_html_output(exclude = "epub")) './children/ZtablesHTML.Rmd'}

```{r, child = if (knitr::is_html_output(excludes = "epub3")) './children/ZtablesHTML.Rmd'}
```

```{r, child = if (knitr::is_html_output(exclude = "epub")) './children/InstructionsZtablesHTML.Rmd'}
```{r, child = if (knitr::is_html_output(excludes = "epub3")) './children/InstructionsZtablesHTML.Rmd'}
```


fred

```{r, child = if (knitr::is_latex_output()) './children/ZtablesLaTeX.Rmd'}
```

```{r, child = if (knitr::pandoc_to("epub")) './children/ZtablesLaTeX.Rmd'}
<!-- The LaTeX file contains *both* forwards and backwards tables -->



```{r, child = if (knitr::pandoc_to("epub3")) './children/ZtablesLaTeX.Rmd'}
```



<!-- Backwards tables -->
<!-- Backwards tables for HTML only -->

```{r, child = if (knitr::is_html_output(exclude = "epub")) './children/ZtablesHTMLBackwards.Rmd'}
```{r, child = if (knitr::is_html_output(excludes = "epub3")) './children/ZtablesHTMLBackwards.Rmd'}
```

```{r, child = if (knitr::is_html_output(exclude = "epub")) './children/InstructionsZtablesHTMLBackwards.Rmd'}
```
<!-- The LaTeX file contains *both* forwards and backwards tables -->

```{r, child = if (knitr::is_latex_output()) './children/ZtablesLaTeX.Rmd'}
```

```{r, child = if (knitr::pandoc_to("epub")) './children/ZtablesLaTeX.Rmd'}
```{r, child = if (knitr::is_html_output(excludes = "epub3")) './children/InstructionsZtablesHTMLBackwards.Rmd'}
```





88 changes: 44 additions & 44 deletions _bookdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,51 @@ before_chapter_script:
delete_merged_file: yes
rmd_files:
- index.Rmd
- 01-intro.Rmd
#- 01-intro.Rmd
- 02-RQs.Rmd
- 03-ResearchDesign-TypesOfDesigns.Rmd
- 04-ResearchDesign-Ethics.Rmd
- 05-ResearchDesign-Sampling.Rmd
- 06-ResearchDesign-Internal-Overview.Rmd
- 07-ResearchDesign-Internal-Exp.Rmd
- 08-ResearchDesign-Internal-Obs.Rmd
- 09-ResearchDesign-Limitations.Rmd
- 10-Collect.Rmd
- 11-DescribingVariables.Rmd
- 12-Graphs.Rmd
- 13-NumericalQuant.Rmd
- 14-Numerical-Qual.Rmd
- 15-Tools-DecisionMaking.Rmd
- 16-Tools-Probability.Rmd
- 17-Tools-DistributionsAndModels.Rmd
- 18-Tools-SamplingVariation.Rmd
- 19-CIs-Intro.Rmd
- 20-CIs-OneProportion.Rmd
- 21-CIs-More.Rmd
- 22-CIs-OneMean.Rmd
- 23-CIs-MeanDifference.Rmd
- 24-CIs-TwoMeans.Rmd
- 25-CIs-OddsRatios.Rmd
- 26-Sample-Size-Estimation.Rmd
- 27-Testing-Intro.Rmd
- 28-Testing-OneMean.Rmd
- 29-Testing-More.Rmd
- 30-Testing-MeanDifference.Rmd
- 31-Testing-TwoMeans.Rmd
- 32-Testing-OddsRatios.Rmd
- 33-Testing-Selecting.Rmd
- 34-Relationships-Two-Quant.Rmd
- 35-Correlation.Rmd
- 36-Regression.Rmd
- 37-Read.Rmd
- 38-Write.Rmd
- 39-App-DataSets.Rmd
- 40-App-Tables.Rmd
- 41-App-Symbols.Rmd
- 42-App-Answers.Rmd
- 43-App-Checklists.Rmd
- 44-App-ImageCredits.Rmd
- 45-App-Glossary.Rmd
# - 03-ResearchDesign-TypesOfDesigns.Rmd
# - 04-ResearchDesign-Ethics.Rmd
# - 05-ResearchDesign-Sampling.Rmd
# - 06-ResearchDesign-Internal-Overview.Rmd
# - 07-ResearchDesign-Internal-Exp.Rmd
# - 08-ResearchDesign-Internal-Obs.Rmd
# - 09-ResearchDesign-Limitations.Rmd
# - 10-Collect.Rmd
# - 11-DescribingVariables.Rmd
# - 12-Graphs.Rmd
# - 13-NumericalQuant.Rmd
# - 14-Numerical-Qual.Rmd
# - 15-Tools-DecisionMaking.Rmd
# - 16-Tools-Probability.Rmd
# - 17-Tools-DistributionsAndModels.Rmd
# - 18-Tools-SamplingVariation.Rmd
# - 19-CIs-Intro.Rmd
# - 20-CIs-OneProportion.Rmd
# - 21-CIs-More.Rmd
# - 22-CIs-OneMean.Rmd
# - 23-CIs-MeanDifference.Rmd
# - 24-CIs-TwoMeans.Rmd
# - 25-CIs-OddsRatios.Rmd
# - 26-Sample-Size-Estimation.Rmd
# - 27-Testing-Intro.Rmd
# - 28-Testing-OneMean.Rmd
# - 29-Testing-More.Rmd
# - 30-Testing-MeanDifference.Rmd
# - 31-Testing-TwoMeans.Rmd
# - 32-Testing-OddsRatios.Rmd
# - 33-Testing-Selecting.Rmd
# - 34-Relationships-Two-Quant.Rmd
# - 35-Correlation.Rmd
# - 36-Regression.Rmd
# - 37-Read.Rmd
# - 38-Write.Rmd
# - 39-App-DataSets.Rmd
# - 40-App-Tables.Rmd
# - 41-App-Symbols.Rmd
# - 42-App-Answers.Rmd
# - 43-App-Checklists.Rmd
# - 44-App-ImageCredits.Rmd
# - 45-App-Glossary.Rmd
- 46-References.Rmd
language:
label:
Expand Down
5 changes: 2 additions & 3 deletions children/ZtablesHTML.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ ZtabAll <- data.frame(
datatable(ZtabAll,
filter = 'top',
rownames=FALSE,
options = list(
pageLength = 10,
autoWidth = FALSE
options = list( pageLength = 10,
autoWidth = FALSE
)
)
```
Expand Down
7 changes: 3 additions & 4 deletions children/ZtablesHTMLBackwards.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The table gives the $z$-score such that a given probability (area) is to the lef
For example:
Look up an area of 10%, and the corresponding $z$-score is $z = -1.282$;
that is,
the area to the left of $z=1.282$ is about 10%.
the area to the left of $z = 1.282$ is about 10%.

To use this table,
enter that area *to the left* in the search box *under* the `Area.to.left` column.
Expand All @@ -76,9 +76,8 @@ ZtabAllBackwards <- data.frame(
datatable(ZtabAllBackwards,
filter = 'top',
rownames=FALSE,
options = list(
pageLength = 10,
autoWidth = FALSE
options = list(pageLength = 10,
autoWidth = FALSE
)
)
```
Loading

0 comments on commit e155a12

Please sign in to comment.