Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbatra committed Feb 15, 2024
2 parents 3acf660 + b7cf9fa commit b48881b
Show file tree
Hide file tree
Showing 71 changed files with 626 additions and 624 deletions.
Binary file modified data/surveillance_linelist_clean_20141201.rds
Binary file not shown.
22 changes: 11 additions & 11 deletions intro/full_text/intro1/intro1.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ knitr::include_graphics(xfun::relative_path(here::here("images", "functions_pack

```{r include=FALSE}
surv <- tribble(
~case, ~case_def, ~gender, ~age,
~case, ~case_def, ~sex, ~age,
1, "Confirmed", "female", 1,
2, "Confirmed", "male", 16,
3, "Suspect", "female", 10,
Expand All @@ -1070,7 +1070,7 @@ surv <- tribble(

This dataset in R has the name **`surv`**.

We want a cross-tabulation of columns `case_def` and `gender`.
We want a cross-tabulation of columns `case_def` and `sex`.


```{r, echo=F, eval=T}
Expand Down Expand Up @@ -1106,7 +1106,7 @@ tbl_cross(data =, row =, col = )

This dataset in R has the name **`surv`**.

We want a cross-tabulation of columns `case_def` and `gender`.
We want a cross-tabulation of columns `case_def` and `sex`.


```{r, echo=F, eval=T}
Expand Down Expand Up @@ -1142,7 +1142,7 @@ tbl_cross(

This dataset in R has the name **`surv`**.

We want a cross-tabulation of columns `case_def` and `gender`.
We want a cross-tabulation of columns `case_def` and `sex`.


```{r, echo=F, eval=T}
Expand Down Expand Up @@ -1179,7 +1179,7 @@ tbl_cross(

This dataset in R has the name **`surv`**.

We want a cross-tabulation of columns `case_def` and `gender`.
We want a cross-tabulation of columns `case_def` and `sex`.


```{r, echo=F, eval=T}
Expand All @@ -1195,12 +1195,12 @@ surv %>%

.pull-right[

The *rows* of the cross-table should come from the column **`gender`**
The *rows* of the cross-table should come from the column **`sex`**

```{r, echo=T, eval=F}
tbl_cross(
data = surv,
* row = gender,
* row = sex,
col = )
```

Expand All @@ -1216,7 +1216,7 @@ tbl_cross(

This dataset in R has the name **`surv`**.

We want a cross-tabulation of columns `case_def` and `gender`.
We want a cross-tabulation of columns `case_def` and `sex`.


```{r, echo=F, eval=T}
Expand All @@ -1237,7 +1237,7 @@ The *columns* of the cross-table should come from the column **`case_def`**
```{r, echo=T, eval=F}
tbl_cross(
data = surv,
row = gender,
row = sex,
* col = case_def)
```

Expand All @@ -1255,7 +1255,7 @@ tbl_cross(

This dataset in R has the name **`surv`**.

We want a cross-tabulation of columns `case_def` and `gender`.
We want a cross-tabulation of columns `case_def` and `sex`.


```{r, echo=F, eval=T}
Expand All @@ -1273,7 +1273,7 @@ Now we run the command to create the cross-table
```{r, echo=T, eval=T}
tbl_cross(
data = surv,
row = gender,
row = sex,
col = case_def)
```

Expand Down
168 changes: 85 additions & 83 deletions intro/full_text/intro1/intro1.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions intro/full_text/intro3/intro3.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Let's use a smaller version to practice with, and explore some core R functions
```{r, echo=F}
demo <- surv_raw %>%
head(5) %>%
select(case_id, age, gender, lab_confirmed, fever, epilink)
select(case_id, age, sex, lab_confirmed, fever, epilink)
```

```{r, eval=T}
Expand Down Expand Up @@ -272,38 +272,38 @@ Note how the column names in `demo` are old! It's because our changes have not y

`mutate()` is also used to *edit* existing columns, such as *recoding* values

Below, `recode()` is used inside `mutate()` to recode the gender column
Below, `recode()` is used inside `mutate()` to recode the sex column

--



```{r, echo=params$lang == "en", eval=params$lang == "en"}
demo %>%
mutate(gender = recode(gender, # re-define gender as:
mutate(sex = recode(sex, # re-define sex as:
"m" = "male", # when "m", change to "male"
"f" = "female")) # when "f", change to "female"
```


```{r, echo=params$lang == "fr", eval=params$lang == "fr"}
demo %>%
mutate(gender = recode(gender, # redéfinir le sexe:
mutate(sex = recode(sex, # redéfinir le sexe:
"m" = "male", # ou "m" devient "male"
"f" = "female")) # ou "f" devient "female"
```


```{r, echo=params$lang == "ru", eval=params$lang == "ru"}
demo %>%
mutate(gender = recode(gender, # переопределить пол как:
mutate(sex = recode(sex, # переопределить пол как:
"m" = "male", # когда "m", меняется на "male"
"f" = "female")) # когда "f", меняется на "female"
```

```{r, echo=params$lang == "es", eval=params$lang == "es"}
demo %>%
mutate(gender = recode(gender, #redefinir género como:
mutate(sex = recode(sex, #redefinir género como:
"m" = "male", # cuando "m", cambiar a "masculino"
"f" = "female")) # cuando "f", cambiar a "mujer"
```
Expand Down
Loading

0 comments on commit b48881b

Please sign in to comment.