From a2522aaddb86834d95f45b7a51b07564042186e0 Mon Sep 17 00:00:00 2001 From: "George G. Vega Yon" Date: Fri, 25 Oct 2024 11:41:31 -0600 Subject: [PATCH 1/5] Hot fix! --- NEWS.md | 2 +- tests/testthat/test_preprocess_ww_data.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index c0ebcea6..c471d68d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ ## User-visible changes -- `wwinference` now checks whether `site_pop` is unique per site (see issue [#223](https://github.com/CDCgov/ww-inference-model/issues/226) and reported by [@akeyel](https://github.com/akeyel)). +- `wwinference` now checks whether `site_pop` is fixed per site (see issue [#223](https://github.com/CDCgov/ww-inference-model/issues/226) and reported by [@akeyel](https://github.com/akeyel)). ## Internal changes diff --git a/tests/testthat/test_preprocess_ww_data.R b/tests/testthat/test_preprocess_ww_data.R index 4c7ea160..2b0b7d5b 100644 --- a/tests/testthat/test_preprocess_ww_data.R +++ b/tests/testthat/test_preprocess_ww_data.R @@ -382,7 +382,7 @@ test_that("Function handles LOD values equal to concentration values", { test_that("Constant population per site", { wrong_pop <- ww_data - ww_data$site_pop <- sample(ww_data$site_pop) + ww_data$site_pop <- 1e6 + seq_len(nrow(ww_data)) expect_error( preprocess_ww_data( From 34c91791076d5c47590cff6d6c43d6f8755b75f8 Mon Sep 17 00:00:00 2001 From: "George G. Vega Yon" Date: Fri, 25 Oct 2024 11:57:00 -0600 Subject: [PATCH 2/5] There was probably a single site! --- tests/testthat/test_preprocess_ww_data.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test_preprocess_ww_data.R b/tests/testthat/test_preprocess_ww_data.R index 2b0b7d5b..5e60f2b6 100644 --- a/tests/testthat/test_preprocess_ww_data.R +++ b/tests/testthat/test_preprocess_ww_data.R @@ -381,12 +381,15 @@ test_that("Function handles LOD values equal to concentration values", { }) test_that("Constant population per site", { - wrong_pop <- ww_data - ww_data$site_pop <- 1e6 + seq_len(nrow(ww_data)) + wrong_pop <- cbind( + ww_data, + ww_data |> dplyr::mutate(site = max(.data$site) + 1) + ) + wrong_pop$site_pop <- 1e6 + seq_len(nrow(ww_data)) expect_error( preprocess_ww_data( - ww_data, + wrong_pop, conc_col_name = "conc", lod_col_name = "lod" ), From 3621be035ce7f1c25854b080c0e9a3ca24ac798b Mon Sep 17 00:00:00 2001 From: "George G. Vega Yon" Date: Fri, 25 Oct 2024 12:11:38 -0600 Subject: [PATCH 3/5] Correcting site name --- tests/testthat/test_preprocess_ww_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test_preprocess_ww_data.R b/tests/testthat/test_preprocess_ww_data.R index 5e60f2b6..0bd85066 100644 --- a/tests/testthat/test_preprocess_ww_data.R +++ b/tests/testthat/test_preprocess_ww_data.R @@ -383,7 +383,7 @@ test_that("Function handles LOD values equal to concentration values", { test_that("Constant population per site", { wrong_pop <- cbind( ww_data, - ww_data |> dplyr::mutate(site = max(.data$site) + 1) + ww_data |> dplyr::mutate(site = "wrong pop") ) wrong_pop$site_pop <- 1e6 + seq_len(nrow(ww_data)) From cac864d1bf65fb2a7a32a75694dc1229251a0b6d Mon Sep 17 00:00:00 2001 From: Kaitlyn Johnson Date: Wed, 30 Oct 2024 13:16:58 -0400 Subject: [PATCH 4/5] fix cbind, dont want duplicat column names, use seq_len but differently --- tests/testthat/test_preprocess_ww_data.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test_preprocess_ww_data.R b/tests/testthat/test_preprocess_ww_data.R index 0bd85066..6b4e668e 100644 --- a/tests/testthat/test_preprocess_ww_data.R +++ b/tests/testthat/test_preprocess_ww_data.R @@ -381,10 +381,8 @@ test_that("Function handles LOD values equal to concentration values", { }) test_that("Constant population per site", { - wrong_pop <- cbind( - ww_data, - ww_data |> dplyr::mutate(site = "wrong pop") - ) + wrong_pop <- ww_data + wrong_pop$site_pop <- 1e6 + seq_len(nrow(ww_data)) expect_error( From 1432e5d1f0c69d54fac850dbea20989b1dc6db97 Mon Sep 17 00:00:00 2001 From: Kaitlyn Johnson <94390107+kaitejohnson@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:14:19 -0400 Subject: [PATCH 5/5] Update NEWS.md Co-authored-by: Dylan H. Morris --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index c471d68d..5adf1ca4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ ## User-visible changes -- `wwinference` now checks whether `site_pop` is fixed per site (see issue [#223](https://github.com/CDCgov/ww-inference-model/issues/226) and reported by [@akeyel](https://github.com/akeyel)). +- `wwinference` now checks whether `site_pop` is fixed per site (see issue [#223](https://github.com/CDCgov/ww-inference-model/issues/226) reported by [@akeyel](https://github.com/akeyel)). ## Internal changes