Skip to content

Commit 7421d11

Browse files
committed
update tests
1 parent 7e45ff6 commit 7421d11

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

facebook/delphiFacebook/R/responses.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,13 @@ experimental_arm_assignment <- function(input_data, wave) {
537537
#'
538538
#' @param input_data data frame of responses
539539
#' @param county_crosswalk crosswalk mapping ZIP5 to counties
540+
#' @param params list containing `produce_individual_raceeth`, indicating
541+
#' whether or not to issue microdata with race-ethnicity field
540542
#' @importFrom stringi stri_trim stri_replace_all
541543
#' @importFrom dplyr left_join group_by filter ungroup select rename
542544
#'
543545
#' @export
544-
create_complete_responses <- function(input_data, county_crosswalk)
546+
create_complete_responses <- function(input_data, county_crosswalk, params)
545547
{
546548
cols_to_report <- c(
547549
"start_dt", "end_dt", "date",

facebook/delphiFacebook/R/run.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ run_facebook <- function(params)
3131
msg_df("response data to aggregate", data_agg)
3232

3333
# create "complete" data that will be shared with research partners
34-
data_full <- create_complete_responses(input_data, cw_list$county)
34+
data_full <- create_complete_responses(input_data, cw_list$county, params)
3535
data_full <- filter_complete_responses(data_full, params)
3636
data_full <- join_weights(data_full, params, weights = "full")
3737
msg_df("full data to share with research partners", data_full)

facebook/delphiFacebook/man/create_complete_responses.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

facebook/delphiFacebook/unit-tests/testthat/test-responses.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,17 @@ test_that("filter_data_for_aggregation works correctly", {
124124
hh_number_sick = c(0, NA, 4, -5, 55, 5, 5, 5, 3, 3, 0, 30, 1),
125125
hh_number_total = c(1, 4, NA, 5, 5, -5, 100, 5, 5, 1, 1, 30, 1),
126126
day = c("2021-01-01", "2021-01-01", "2021-01-02", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2020-01-01"),
127-
date = c("2021-01-01", "2021-01-01", "2021-01-02", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2020-01-01")
127+
date = c("2021-01-01", "2021-01-01", "2021-01-02", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01", "2020-01-01"),
128+
wave = 12
128129
)
129130

130131
expected <- tibble(
131132
zip5 = c("10001", "10001", "10001", "10001"),
132133
hh_number_sick = c(5, 3, 0, 30),
133134
hh_number_total = c(5, 5, 1, 30),
134135
day = c("2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01"),
135-
date = c("2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01")
136+
date = c("2021-01-01", "2021-01-01", "2021-01-01", "2021-01-01"),
137+
wave = 12
136138
)
137139

138140
expect_equal(filter_data_for_aggregation(input, params),

0 commit comments

Comments
 (0)