Skip to content

Commit 5be8d49

Browse files
add to the exercise.setup tabac_table and blood_table
1 parent 5140005 commit 5be8d49

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: BioDataScience1
2-
Version: 2020.5.1
2+
Version: 2020.6.0
33
Title: A Series of Learnr Documents for Biological Data Science 1
44
Description: Interactive documents using learnr for studying biological data science.
55
Authors@R: c(

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# BioDataScience1 News
22

3+
## Changes in version 2020.6.0
4+
5+
- Add to the exercice.setup tabac_table and blood_table for the exercises of A08Lb_chi2b
6+
37
## Changes in version 2020.5.1
48

59
- Value of an argument in last exercise of A08La_chi2 is specified: `rescale.p = FALSE` in order to avoid ambiguity on the values required for the other arguments.

inst/tutorials/A08Lb_chi2b/A08Lb_chi2b.Rmd

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: "Guyliann Engels & Philippe Grosjean"
44
description: "**SDD I Module 8** Applications du test du Chi2."
55
tutorial:
66
id: "A08Lb_chi2b"
7-
version: 2.0.0/10
7+
version: 2.1.0/10
88
output:
99
learnr::tutorial:
1010
progressive: true
@@ -147,7 +147,15 @@ Maintenant, calculez le même test d'hypothèse, mais avec la fonction dédiée
147147

148148
💬 **Ce code correspond au snippet `.hcchi2bi`** [`.hc` = `h`ypothesis tests: `c`ontingency].
149149

150-
```{r chi2_test_h2, exercise=TRUE}
150+
```{r tabac-prepare}
151+
tabac <- tibble::tibble(
152+
genre = c("fille", "garçon", "fille", "garçon"),
153+
comportement = c("fumeur", "fumeur", "non fumeur", "non fumeur"),
154+
freq = c(11, 22, 28, 19))
155+
tabac_table <- xtabs(data = tabac, freq ~ genre + comportement)
156+
```
157+
158+
```{r chi2_test_h2, exercise=TRUE, exercise.setup = "tabac-prepare"}
151159
(chi2. <- chisq.test(___, correct = FALSE)); cat("Expected frequencies:\n"); chi2.[["expected"]]
152160
```
153161

@@ -232,7 +240,17 @@ Calculez le test $\chi^2$ d'indépendance dans R pour ce jeu de données directe
232240

233241
💬 **Ce code correspond au snippet `.hcchi2bi`.**
234242

235-
```{r chi_blood_h2, exercise=TRUE}
243+
```{r blood-prepare}
244+
blood <- tibble::tibble(
245+
group = c("A", "B", "AB", "O", "A", "B", "AB", "O", "A", "B", "AB", "O"),
246+
state = c("Floride", "Floride", "Floride", "Floride",
247+
"Iowa", "Iowa", "Iowa", "Iowa",
248+
"Missouri", "Missouri", "Missouri", "Missouri"),
249+
freq = c(122, 117, 19, 244, 1781, 1351, 289, 3301, 353, 269, 60, 713))
250+
blood_table <- xtabs(data = blood, freq ~ group + state)
251+
```
252+
253+
```{r chi_blood_h2, exercise=TRUE, exercise.setup = "blood-prepare"}
236254
(chi2. <- chisq.test(___)); cat("Expected frequencies:\n"); chi2.[["expected"]]
237255
```
238256

0 commit comments

Comments
 (0)