This is an internal function which filters dataframes of SWAP data by depth and variable. It might be useful for end users as well, which is why its accessible.
filter_swap_data(data, variable = NULL, depth = NULL)
as given by load_observed()$data
or load_swap_output()$custom_depth
(dataframe)
name(s) of the variables you would like to select, leave blank for all. (string)
value(s) of the depths you would like to select, leave blank for all. (numeric)
Returns a dataframe with a DATE
column, followed by the desired data.
# path to sample results (only for package internal example, you don't need
# this function)
example_path <- system.file(package = "rswap", "extdata/rswap_example_output")
# in your own projects, you would use something like this:
# example_path <- "C:/path/to/swap_folder/example_project"
# load some SWAP data (either observed, or modeled using load_swap_output())
data <- load_swap_observed(project_path = example_path, verbose = TRUE)
#> ✅ Observed data loaded
filter_swap_data(data, var = "WC", depth = "15")
#> # A tibble: 36 × 2
#> DATE WC_15
#> <date> <dbl>
#> 1 2002-01-31 0.315
#> 2 2002-02-28 0.342
#> 3 2002-03-31 0.287
#> 4 2002-04-30 0.314
#> 5 2002-05-31 0.286
#> 6 2002-06-30 0.244
#> 7 2002-07-31 0.397
#> 8 2002-08-31 0.220
#> 9 2002-09-30 0.210
#> 10 2002-10-31 0.274
#> # ℹ 26 more rows