Skip to content

Commit cd750c8

Browse files
committed
make sure climate has pop available
1 parent 3d2dd47 commit cd750c8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

R/forecasters/data_transforms.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ climate_median <- function(epi_data, target, ahead, window_size = 3, recent_wind
295295
filter((season != "2020/21") & (season != "2021/22") & (season != "2019/20"))
296296
if (!scale_rate) {
297297
# add the
298+
if (!("population" %in% names(filtered))) {
299+
filtered %<>%
300+
left_join(get_population_data() %>% select(state_id, population), by = join_by(geo_value == state_id))
301+
}
298302
filtered %<>% mutate(across(all_of(target), \(x) x / population * 1e5))
299303
}
300304
week_ahead <- as.integer(floor((ahead) / 7))

0 commit comments

Comments
 (0)