diff --git a/.Rbuildignore b/.Rbuildignore index cc3e600b..0b4b1542 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -15,4 +15,7 @@ ^\.editorconfig$ ^\.lintr$ ^Makefile$ - +^venv$ +^.venv$ +^env$ +^.env$ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0525b5b7..04490d85 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,8 @@ .Ruserdata docs inst/doc -/check \ No newline at end of file +/check +venv +env +.venv +.env \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index 517a3da4..4358689f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,7 +25,7 @@ Imports: readr, MMWRweek, rlang -RoxygenNote: 7.2.1 +RoxygenNote: 7.2.3 Suggests: knitr, magrittr, diff --git a/R/endpoints.R b/R/endpoints.R index 465b1480..b1b7cd28 100644 --- a/R/endpoints.R +++ b/R/endpoints.R @@ -104,8 +104,8 @@ covid_hosp_facility_lookup <- check_single_string_param("state", state, FALSE) check_single_string_param("ccn", ccn, FALSE) check_single_string_param("city", city, FALSE) - check_single_int_param("zip", zip, FALSE) - check_single_int_param("fips_code", fips_code, FALSE) + check_single_string_param("zip", zip, FALSE) + check_single_string_param("fips_code", fips_code, FALSE) if (missing(state) && missing(ccn) && missing(city) && missing(zip) && missing(fips_code)) { @@ -129,7 +129,7 @@ covid_hosp_facility_lookup <- create_epidata_field_info("city", "text"), create_epidata_field_info("zip", "text"), create_epidata_field_info("hospital_subtype", "text"), - create_epidata_field_info("fip_code", "text"), + create_epidata_field_info("fips_code", "text"), create_epidata_field_info("is_metro_micro", "int") ) ) @@ -175,7 +175,7 @@ covid_hosp_facility <- create_epidata_field_info("hospital_subtype", "text"), create_epidata_field_info("fips_code", "text"), create_epidata_field_info("publication_date", "date"), - create_epidata_field_info("collection_week", "epiweek"), + create_epidata_field_info("collection_week", "date"), create_epidata_field_info("is_metro_micro", "bool"), create_epidata_field_info("total_beds_7_day_sum", "int"), create_epidata_field_info("all_adult_hospital_beds_7_day_sum", "int"), diff --git a/R/utils.R b/R/utils.R index 70ad8859..0ffd9f2e 100644 --- a/R/utils.R +++ b/R/utils.R @@ -6,7 +6,7 @@ format_item <- function(value) { "from" %in% names(value) && "to" %in% names(value) && length(names(value)) == 2) { paste0(toString(value$from), "-", toString(value$to)) } else { - toString(value) + paste(value, collapse = ",") } } @@ -16,5 +16,5 @@ format_list <- function(values) { ("from" %in% names(values) && "to" %in% names(values))) { values <- list(values) } - paste(sapply(values, format_item), collapse = ",") + paste(vapply(values, format_item, character(1L)), collapse = ",") } diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index f750d510..6b785959 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -8,7 +8,10 @@ test_that("format_list", { expect_equal(format_list(5), "5") expect_equal(format_list("5"), "5") expect_equal(format_list(list(from = 2, to = 5)), "2-5") + expect_equal(format_list(list(list(from = 2, to = 6))), "2-6") expect_equal(format_list(epirange(2, 8)), "2-8") + expect_equal(format_list(list(epirange(2, 9))), "2-9") expect_equal(format_list(list("5", "4")), "5,4") expect_equal(format_list(list(3, list(from = 2, to = 5))), "3,2-5") + expect_equal(format_list(list(c(3, 8), list(from = 2, to = 5))), "3,8,2-5") })