select_datasets | R Documentation |
These functions use dplyr-like selection syntax to quickly subset a mudata object by param, location, or dataset. Params, locations, an datasets can also be renamed using keyword arguments, identical to dplyr selection syntax.
select_datasets(.data, ...)
## Default S3 method:
select_datasets(.data, ..., .factor = FALSE)
select_locations(.data, ...)
## Default S3 method:
select_locations(.data, ..., .factor = FALSE)
select_params(.data, ...)
## Default S3 method:
select_params(.data, ..., .factor = FALSE)
.data |
A mudata object |
... |
Quoted names, bare names, or helpers like starts_with, contains, ends_with, one_of, or matches. |
.factor |
If TRUE, the new object will keep the order specified by converting columns to factors. This may be useful for specifying order when using ggplot2. |
A subsetted mudata object.
select, rename_locations, distinct_locations, filter_locations
# renaming can be handy when locations are verbosely named
ns_climate %>%
select_locations(
sable_island = starts_with("SABLE"),
nappan = starts_with("NAPPAN"),
baddeck = starts_with("BADDECK")
) %>%
select_params(ends_with("temp"))
# can also use quoted values
long_lake %>%
select_params("Pb", "As", "Cr")
# can also use negative values to remove params/datasets/locations
long_lake %>%
select_params(-Pb)
# to get around non-standard evaluation, use one_of()
my_params <- c("Pb", "As", "Cr")
long_lake %>%
select_params(one_of(my_params))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.