diff --git a/R/get_measurements.R b/R/get_measurements.R index 00e8fb6..f996e21 100644 --- a/R/get_measurements.R +++ b/R/get_measurements.R @@ -14,7 +14,7 @@ #' get_measurements(gauge) #' get_measurements(gauge, discharge = TRUE) #' -#' gauges <- get_gauges() |> dplyr::filter(waterbody == "Hüller Bach") +#' gauges <- get_gauges() |> dplyr::filter(waterbody == "Hammbach") #' #' get_measurements(gauges) get_measurements <- function(x = NULL, diff --git a/R/get_meta.R b/R/get_meta.R index b9a4623..18772e9 100644 --- a/R/get_meta.R +++ b/R/get_meta.R @@ -11,7 +11,7 @@ #' gauge <- get_gauges() |> dplyr::filter(id == "10103") #' get_meta(gauge) #' -#' gauges <- get_gauges() |> dplyr::filter(waterbody == "Hüller Bach") +#' gauges <- get_gauges() |> dplyr::filter(waterbody == "Hammbach") #' get_meta(gauges) get_meta <- function(x = NULL) { diff --git a/man/get_measurements.Rd b/man/get_measurements.Rd index 7655f06..f58d937 100644 --- a/man/get_measurements.Rd +++ b/man/get_measurements.Rd @@ -23,7 +23,7 @@ gauge <- get_gauges() |> dplyr::filter(id == "10103") get_measurements(gauge) get_measurements(gauge, discharge = TRUE) -gauges <- get_gauges() |> dplyr::filter(waterbody == "Hüller Bach") +gauges <- get_gauges() |> dplyr::filter(waterbody == "Hammbach") get_measurements(gauges) } diff --git a/man/get_meta.Rd b/man/get_meta.Rd index 19e1323..a4e3398 100644 --- a/man/get_meta.Rd +++ b/man/get_meta.Rd @@ -19,7 +19,7 @@ Get gauge metadata gauge <- get_gauges() |> dplyr::filter(id == "10103") get_meta(gauge) -gauges <- get_gauges() |> dplyr::filter(waterbody == "Hüller Bach") +gauges <- get_gauges() |> dplyr::filter(waterbody == "Hammbach") get_meta(gauges) } \seealso{ diff --git a/tests/testthat/test-get_measurements.R b/tests/testthat/test-get_measurements.R index 34bd389..7acfb57 100644 --- a/tests/testthat/test-get_measurements.R +++ b/tests/testthat/test-get_measurements.R @@ -2,37 +2,41 @@ test_that("Output class is as expected.", { x <- gauges_ref |> dplyr::filter(id == "10103") - - meas_1 <- get_measurements(x) expect_equal(class(meas_1), "list") expect_s3_class(meas_1[[1]], c("xts", "zoo")) - - meas_2 <- get_measurements(x, discharge = TRUE) expect_equal(class(meas_2), "list") expect_s3_class(meas_2[[1]], c("xts", "zoo")) + + + + y <- gauges_ref |> dplyr::filter(waterbody == "Hammbach") + + meas_3 <- get_measurements(y) + + expect_equal(class(meas_3), "list") + + expect_s3_class(meas_3[[1]], c("xts", "zoo")) + + expect_s3_class(meas_3[[2]], c("xts", "zoo")) }) test_that("Attributes are as expected.", { x <- gauges_ref |> dplyr::filter(id == "10103") - - meas_1 <- get_measurements(x) expect_equal(attr(meas_1[[1]], "STAT_ID"), "10103") expect_equal(attr(meas_1[[1]], "PARAMETER"), "waterlevel") - - meas_2 <- get_measurements(x, discharge = TRUE) expect_equal(attr(meas_2[[1]], "STAT_ID"), "10103") diff --git a/tests/testthat/test-get_meta.R b/tests/testthat/test-get_meta.R index bb3738e..e6c7716 100644 --- a/tests/testthat/test-get_meta.R +++ b/tests/testthat/test-get_meta.R @@ -5,6 +5,12 @@ test_that("Output class is as expected.", { meta <- get_meta(x) expect_s3_class(meta, c("tbl_df", "tbl", "data.frame")) + + y <- gauges_ref |> dplyr::filter(waterbody == "Hammbach") + + meta <- get_meta(y) + + expect_s3_class(meta, c("tbl_df", "tbl", "data.frame")) }) test_that("Dimensions are as expected.", { @@ -14,6 +20,12 @@ test_that("Dimensions are as expected.", { meta <- get_meta(x) expect_equal(dim(meta), c(1, 9)) + + y <- gauges_ref |> dplyr::filter(waterbody == "Hammbach") + + meta <- get_meta(y) + + expect_equal(dim(meta), c(2, 9)) }) test_that("Column names are as expected.", {