Skip to content

Commit e935edb

Browse files
committed
styler
1 parent dc6e1bf commit e935edb

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

README.Rmd

+21-13
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ secondary <- "#f9c80e"
4949
tertiary <- "#177245"
5050
fourth_colour <- "#A393BF"
5151
fifth_colour <- "#2e8edd"
52-
colvec <- c(base = base, primary = primary, secondary = secondary,
53-
tertiary = tertiary, fourth_colour = fourth_colour,
54-
fifth_colour = fifth_colour)
52+
colvec <- c(
53+
base = base, primary = primary, secondary = secondary,
54+
tertiary = tertiary, fourth_colour = fourth_colour,
55+
fifth_colour = fifth_colour
56+
)
5557
library(epiprocess)
5658
suppressMessages(library(tidyverse))
5759
theme_update(legend.position = "bottom", legend.title = element_blank())
@@ -61,7 +63,7 @@ delphi_pal <- function(n) {
6163
}
6264
scale_fill_delphi <- function(..., aesthetics = "fill") {
6365
discrete_scale(aesthetics = aesthetics, palette = delphi_pal, ...)
64-
}
66+
}
6567
scale_color_delphi <- function(..., aesthetics = "color") {
6668
discrete_scale(aesthetics = aesthetics, palette = delphi_pal, ...)
6769
}
@@ -124,7 +126,8 @@ cases <- pub_covidcast(
124126
time_type = "day",
125127
geo_type = "state",
126128
time_values = epirange(20200601, 20220101),
127-
geo_values = "*") |>
129+
geo_values = "*"
130+
) |>
128131
select(geo_value, time_value, case_rate = value)
129132
130133
deaths <- pub_covidcast(
@@ -133,7 +136,8 @@ deaths <- pub_covidcast(
133136
time_type = "day",
134137
geo_type = "state",
135138
time_values = epirange(20200601, 20220101),
136-
geo_values = "*") |>
139+
geo_values = "*"
140+
) |>
137141
select(geo_value, time_value, death_rate = value)
138142
cases_deaths <-
139143
full_join(cases, deaths, by = c("time_value", "geo_value")) |>
@@ -156,7 +160,7 @@ First, to eliminate some of the noise coming from daily reporting, we do 7 day a
156160

157161
```{r smooth}
158162
cases_deaths <-
159-
cases_deaths |>
163+
cases_deaths |>
160164
group_by(geo_value) |>
161165
epi_slide(
162166
cases_7dav = mean(case_rate, na.rm = TRUE),
@@ -181,7 +185,8 @@ cases_deaths <-
181185
ungroup() |>
182186
mutate(
183187
death_rate = outlr_death_rate_replacement,
184-
case_rate = outlr_case_rate_replacement) |>
188+
case_rate = outlr_case_rate_replacement
189+
) |>
185190
select(geo_value, time_value, case_rate, death_rate)
186191
cases_deaths
187192
```
@@ -196,8 +201,8 @@ of the states, noting the actual forecast date:
196201
forecast_date_label <-
197202
tibble(
198203
geo_value = rep(plot_locations, 2),
199-
source = c(rep("case_rate",4), rep("death_rate", 4)),
200-
dates = rep(forecast_date - 7*2, 2 * length(plot_locations)),
204+
source = c(rep("case_rate", 4), rep("death_rate", 4)),
205+
dates = rep(forecast_date - 7 * 2, 2 * length(plot_locations)),
201206
heights = c(rep(150, 4), rep(1.0, 4))
202207
)
203208
processed_data_plot <-
@@ -209,7 +214,8 @@ processed_data_plot <-
209214
facet_grid(source ~ geo_value, scale = "free") +
210215
geom_vline(aes(xintercept = forecast_date)) +
211216
geom_text(
212-
data = forecast_date_label, aes(x=dates, label = "forecast\ndate", y = heights), size = 3, hjust = "right") +
217+
data = forecast_date_label, aes(x = dates, label = "forecast\ndate", y = heights), size = 3, hjust = "right"
218+
) +
213219
scale_x_date(date_breaks = "3 months", date_labels = "%Y %b") +
214220
theme(axis.text.x = element_text(angle = 90, hjust = 1))
215221
```
@@ -260,7 +266,8 @@ narrow_data_plot <-
260266
facet_grid(source ~ geo_value, scale = "free") +
261267
geom_vline(aes(xintercept = forecast_date)) +
262268
geom_text(
263-
data = forecast_date_label, aes(x=dates, label = "forecast\ndate", y = heights), size = 3, hjust = "right") +
269+
data = forecast_date_label, aes(x = dates, label = "forecast\ndate", y = heights), size = 3, hjust = "right"
270+
) +
264271
scale_x_date(date_breaks = "3 months", date_labels = "%Y %b") +
265272
theme(axis.text.x = element_text(angle = 90, hjust = 1))
266273
```
@@ -278,7 +285,8 @@ forecast_plot <-
278285
epipredict:::plot_bands(
279286
restricted_predictions,
280287
levels = 0.9,
281-
fill = primary) +
288+
fill = primary
289+
) +
282290
geom_point(data = restricted_predictions, aes(y = .data$value), color = secondary)
283291
```
284292
</details>

0 commit comments

Comments
 (0)