Skip to content

Commit

Permalink
fix lintr checks
Browse files Browse the repository at this point in the history
  • Loading branch information
avallecam committed Nov 5, 2024
1 parent 38b0ba0 commit 2ce0139
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions episodes/delays-refresher.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ cases %>%
pivot_wider(names_from = outcome, values_from = n) %>%
cleanepi::standardize_column_names() %>%
mutate(cases_known_outcome = death + recover) %>%
mutate(cfr = ... / ... ) # replace the ... spaces
mutate(cfr = ... / ...) # replace the ... spaces
```

::::::::::::
Expand All @@ -169,7 +169,7 @@ However, how much time it would take for us register those outcomes?
```{r,echo=FALSE,eval=TRUE}
# demo code not to run by learner
cases %>%
slice_sample(n = 30) %>%
slice_sample(n = 30) %>%
arrange(date_of_onset) %>%
mutate(case_id = fct_inorder(case_id)) %>%
# slice(10:40) %>%
Expand Down Expand Up @@ -231,7 +231,7 @@ cases %>%
```{r}
cases %>%
select(case_id, date_of_onset, date_of_outcome, outcome) %>%
filter(outcome == "Death") %>%
filter(outcome == "Death") %>%
mutate(delay_onset_death = date_of_outcome - date_of_onset) %>%
ggplot(aes(x = delay_onset_death)) +
geom_histogram(binwidth = 1)
Expand Down Expand Up @@ -270,25 +270,24 @@ cases %>%
outbreaks::ebola_sim_clean$linelist %>%
as_tibble() %>%
arrange(date_of_infection) %>%
rownames_to_column() %>%
mutate(rowname = as.numeric(rowname)) %>%
rownames_to_column() %>%
mutate(rowname = as.numeric(rowname)) %>%
# slice_sample(n = 166) %>%
# slice_head(n = 166) %>%
mutate(
looking = case_when(
rowname <= 166 ~ "now",
TRUE ~ "then"
)
) %>%
# count(looking)
) %>%
slice_head(n = 100) %>%
select(case_id, date_of_infection, date_of_onset) %>%
pivot_longer(cols = -case_id, names_to = "date_type", values_to = "date") %>%
count(date, date_type) %>%
group_by(date_type) %>%
mutate(cumulative = cumsum(n)) %>%
ungroup() %>%
ggplot(aes(x = date, y = cumulative, color = date_type)) +
select(case_id, date_of_infection, date_of_onset) %>%
pivot_longer(cols = -case_id, names_to = "date_type", values_to = "date") %>%
count(date, date_type) %>%
group_by(date_type) %>%
mutate(cumulative = cumsum(n)) %>%
ungroup() %>%
ggplot(aes(x = date, y = cumulative, color = date_type)) +
geom_line()
```

Expand Down Expand Up @@ -328,11 +327,15 @@ cases_delay <- cases %>%
mutate(incubation_period = date_of_onset - date_of_infection) %>%
mutate(incubation_period_num = as.numeric(incubation_period)) %>%
filter(!is.na(incubation_period_num))
```

```{r}
cases_delay %>% pull(incubation_period_num)
```

```{r}
Try this yourself:

```{r,eval=FALSE,echo=TRUE}
cases_delay$incubation_period_num
```

Expand All @@ -350,11 +353,15 @@ incubation_period_fit <- cases %>%
filter(!is.na(incubation_period_num)) %>%
pull(incubation_period_num) %>%
fitdistrplus::fitdist(distr = "lnorm")
```

```{r}
incubation_period_fit %>% pluck("estimate")
```

```{r}
Try this yourself:

```{r,eval=FALSE,echo=TRUE}
incubation_period_fit$estimate
```

Expand Down

0 comments on commit 2ce0139

Please sign in to comment.