From 9805bbb6778f0d3dddf74e61316f0adc774534b8 Mon Sep 17 00:00:00 2001 From: CurranGroome Date: Wed, 13 Mar 2024 16:32:37 -0400 Subject: [PATCH] fixing minor bug --- R/compile_acs_data.R | 4 ++-- renv.lock | 20 -------------------- tests/testthat/test-compile_acs_data.R | 3 +++ 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/R/compile_acs_data.R b/R/compile_acs_data.R index f69d256..c323b30 100644 --- a/R/compile_acs_data.R +++ b/R/compile_acs_data.R @@ -119,8 +119,8 @@ geographies over time should be thoroughly quality checked.\n") "combined statistical area" = tigris::combined_statistical_areas(cb = TRUE, year = year), "new england city and town area" = tigris::new_england(cb = TRUE, year = year, type = "NECTA")) %>% dplyr::transmute( - area_land_sq_kilometer = safe_divide(ALAND, 1000000), - area_water_sq_kilometer = safe_divide(AWATER, 1000000), + area_land_sq_kilometer = ALAND / 1000000, + area_water_sq_kilometer = AWATER / 1000000, area_land_water_sq_kilometer = area_land_sq_kilometer + area_water_sq_kilometer, GEOID = GEOID, data_source_year = year) }) diff --git a/renv.lock b/renv.lock index 1251cc5..899a559 100644 --- a/renv.lock +++ b/renv.lock @@ -296,16 +296,6 @@ ], "Hash": "e0b3a53876554bd45879e596cdb10a52" }, - "here": { - "Package": "here", - "Version": "1.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "rprojroot" - ], - "Hash": "24b224366f9c2e7534d2344d10d59211" - }, "hms": { "Package": "hms", "Version": "1.1.3", @@ -520,16 +510,6 @@ ], "Hash": "42548638fae05fd9a9b5f3f437fbbbe2" }, - "rprojroot": { - "Package": "rprojroot", - "Version": "2.0.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "4c8415e0ec1e29f3f4f6fc108bef0144" - }, "rvest": { "Package": "rvest", "Version": "1.0.3", diff --git a/tests/testthat/test-compile_acs_data.R b/tests/testthat/test-compile_acs_data.R index 2b8ef91..b91d621 100644 --- a/tests/testthat/test-compile_acs_data.R +++ b/tests/testthat/test-compile_acs_data.R @@ -49,6 +49,9 @@ summary_statistics = df %>% mean = mean(value, na.rm = T), distinct_values = dplyr::n_distinct(value, na.rm = T)) +summary_statistics %>% + dplyr::filter(stringr::str_detect(name, "area")) + testthat::test_that( "All measures have meaningful values", { purrr::map_dbl(summary_statistics$max, ~testthat::expect_gt(.x, 0) )