Skip to content

Commit

Permalink
fix lintr checks
Browse files Browse the repository at this point in the history
  • Loading branch information
avallecam committed Jun 17, 2024
1 parent 8fb5d66 commit 400775c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
7 changes: 5 additions & 2 deletions episodes/clean-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ Note that, our simulated Ebola does not contain duplicated nor constant rows or
In addition to the regularities, raw data can contain missing values that may be encoded by different strings, including the empty. To ensure robust analysis, it is a good practice to replace all missing values by `NA` in the entire dataset. Below is a code snippet demonstrating how you can achieve this in `{cleanepi}`:

```{r}
sim_ebola_data <- cleanepi::replace_missing_values(sim_ebola_data, na_strings = "")
sim_ebola_data <- cleanepi::replace_missing_values(
data = sim_ebola_data,
na_strings = ""
)
```

### Validating subject IDs
Expand All @@ -136,7 +139,7 @@ Each entry in the dataset represents a subject and should be distinguishable by


```{r}
sim_ebola_data <-
sim_ebola_data <-
cleanepi::check_subject_ids(
data = sim_ebola_data,
target_columns = "case_id",
Expand Down
8 changes: 4 additions & 4 deletions episodes/describe-cases.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ library("ggplot2")
library("tracetheme")
# Plot daily incidence data
base::plot(dialy_incidence_data) +
base::plot(dialy_incidence_data) +
ggplot2::labs(
x = "Time (in days)",
y = "Dialy cases"
) +
) +
tracetheme::theme_trace()
```

Expand All @@ -211,11 +211,11 @@ base::plot(dialy_incidence_data) +
# Plot weekly incidence data
base::plot(weekly_incidence_data) +
base::plot(weekly_incidence_data) +
ggplot2::labs(
x = "Time (in days)",
y = "weekly cases"
) +
) +
tracetheme::theme_trace()
```

Expand Down
2 changes: 1 addition & 1 deletion episodes/read-cases.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ library("RSQLite")
# Create a temporary SQLite database in memory
db_con <- DBI::dbConnect(
drv = RSQLite::SQLite(),
drv = RSQLite::SQLite(),
dbname = ":memory:"
)
Expand Down
14 changes: 7 additions & 7 deletions episodes/simple-analysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ df <- base::subset(
# uses the incidence function from the incidence2 package to compute the
# incidence data
df_incid <- incidence2::incidence(
df,
date_index = "date",
df,
date_index = "date",
groups = "sex"
)
# fit a curve to the incidence data. The model chosen is the negative binomial
# distribution with a significance level (alpha) of 0.05.
fitted_curve_nb <-
fitted_curve_nb <-
i2extras::fit_curve(
df_incid,
model = "negbin",
df_incid,
model = "negbin",
alpha = 0.05
)
Expand All @@ -89,13 +89,13 @@ Repeat the above analysis using Poisson distribution?
:::::::::::::::::::::::: solution

```{r, warning=FALSE, message=FALSE}
fitted_curve_poisson <-
fitted_curve_poisson <-
i2extras::fit_curve(
x = df_incid,
model = "poisson",
alpha = 0.05
)
base::plot(fitted_curve_poisson, angle = 45) +
ggplot2::labs(x = "Date", y = "Cases")
```
Expand Down

0 comments on commit 400775c

Please sign in to comment.