Skip to content

Commit

Permalink
Made callout for usage of linelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Degoot-AM committed Aug 1, 2024
1 parent 5aedf4b commit 13f2188
Showing 1 changed file with 35 additions and 10 deletions.
45 changes: 35 additions & 10 deletions episodes/clean-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,27 @@ data <- linelist::make_linelist(
)
utils::head(data, 7)
```

The `{linelist}` package supplies tags for the common epidemiological variables
and specify them the appropriate data types. You can view the tagged varibles
and their data types using `tags_types` function


::::::::::::::::::::::::::::::::::::: challenge
- View the default tags features linelist

:::::::::::::::::::: hint
```{r, eval=FALSE}
linelist::tags_types()
```
:::::::::::::::::::::::

- How many variables are there? and what are their data types?

::::::::::::::::::::::::::::::::::::::::::::::



The resulting `linelist` object resembles a data frame but offers richer features
and functionalities. Packages that are linelist-aware can leverage these
features. For example, you can extract a dataframe of only the tagged columns
Expand All @@ -326,7 +347,7 @@ Safeguarding is implicitly built into the linelist objects. If you try to delete
columns, you will receive an error or warning message, as shown in the example below.

```{r, warning=TRUE}
new_df <- data |>
new_df <- data |>
dplyr::select(linelist::has_tag(c("id", "age")))
```

Expand All @@ -336,20 +357,15 @@ The default options for lost tags in a linelist object is warning. However, it

- Set the action for lost tags in a linelist to error as follows:

```{r, eval=FALSE}
linelist::lost_tags_action(action = "error")
```
```{r, eval=FALSE}
linelist::lost_tags_action(action = "error")
```
and re-run the above code segment.
- What do you learn for resulting complementary message?

::::::::::::::::::::::::::::::::::::::::::::::::

The `{linelist}` package supplies tags for the common epidemiological variables
and specify them the appropriate data types. You can view this by running the
following command:
```{r, warning=FALSE}
linelist::tags_types()
```

To ensure that all tagged variables are standardized and have the correct data
types, use the `linelist::validate_tags()` and `linelist::validate_types()` functions, respectively, as
shown in the example below:
Expand All @@ -366,6 +382,15 @@ If your dataset contains a `non-default` tag, set the argument
`allow_extra = TRUE` when creating the linelist object.


:::::::::::::::::::::::::::::::::::: callout
- When I should use `{linelist}`?
- linelist is more appropriate for ongoing/long-lasting analysis than
historical/quick analysis. Check
[here](https://epiverse-trace.github.io/linelist/articles/linelist.html#should-i-use-linelist) for more information.

Check warning on line 389 in episodes/clean-data.Rmd

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[uninformative link text]: [here](https://epiverse-trace.github.io/linelist/articles/linelist.html#should-i-use-linelist)

:::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::::::::::::: keypoints

- Use `{cleanepi}` package to clean and standardize epidemic and outbreak data
Expand Down

0 comments on commit 13f2188

Please sign in to comment.