Skip to content

Commit

Permalink
make suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Feb 4, 2022
1 parent 14e112c commit b9887be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions R/processing.R
Expand Up @@ -58,8 +58,7 @@ fill_empty_dates_with_na <- function(data) {
names()
data <- data %>%
complete(
date = full_seq(data$date, period = 1),
nesting(!!!syms(regions))
date = full_seq(data$date, period = 1)
)
return(data)
}
Expand Down
15 changes: 12 additions & 3 deletions tests/testthat/custom_tests/mock_data.R
Expand Up @@ -234,9 +234,18 @@ get_expected_data_for_complete_cumulative_columns_test <- function() {
partial_data <- expected_data[-c(6:9), ]

# manually add cumulative cases to get expected data
full_data_with_cum_cases_filled <- covidregionaldata:::fill_empty_dates_with_na(partial_data)
full_data_with_cum_cases_filled <- dplyr::arrange(full_data_with_cum_cases_filled, level_1_region, date)
full_data_with_cum_cases_filled <- cbind(full_data_with_cum_cases_filled, as.integer(c(1, 5, 5, 15, 2, 7, 7, 18, 3, 3, 3, 15)))
full_data_with_cum_cases_filled <- partial_data %>%
dplyr::group_by(level_1_region) %>%
covidregionaldata:::fill_empty_dates_with_na() %>%
dplyr::ungroup()

full_data_with_cum_cases_filled <-
dplyr::arrange(full_data_with_cum_cases_filled, level_1_region, date)
full_data_with_cum_cases_filled <-
cbind(
full_data_with_cum_cases_filled,
as.integer(c(1, 5, 5, 15, 2, 7, 7, 18, 3, 3, 3, 15))
)
colnames(full_data_with_cum_cases_filled)[5] <- "cases_total"

return(dplyr::tibble(full_data_with_cum_cases_filled))
Expand Down

0 comments on commit b9887be

Please sign in to comment.