query_priors.Rd
Query priors using prepared statements
query_priors(
pft_names = NULL,
traits = NULL,
pft_ids = NULL,
expand = TRUE,
strict = FALSE,
...
)
Character vector of PFT names (`name` column of BETY `pfts` table). You cannot pass both this and `pft_ids`.
Character vector of trait names (`name` column of BETY `traits` table). If `NULL` (default), return information for all traits available for that PFT.
Numeric vector of PFT IDs (`id` column of BETY `pfts` table). You cannot pass both this and `pft_names`.
(Logical) If `TRUE` (default), search every trait-PFT combination. If `FALSE`, assume that input traits and PFTs are paired.
(Logical) If `TRUE`, throw an error if any of the input `pft_names/ids` or `traits` are missing from the output. If `FALSE` (default), only throw a warning.
Additional arguments to [db.query()]
`data.frame` containing prior information for the given PFTs and traits.
if (FALSE) { # \dontrun{
con <- db.open(...)
# No trait provided, so return all available traits
pdat <- query_priors(
c("temperate.Early_Hardwood", "temperate.North_Mid_Hardwood",
"temperate.Late_Hardwood"),
con = con
)
# Traits provided, so restrict to only those traits. Note that
# because `expand = TRUE`, this will search for these traits for
# every PFT.
pdat2 <- query_priors(
c("Optics.Temperate_Early_Hardwood",
"Optics.Temperate_Mid_Hardwood",
"Optics.Temperate_Late_Hardwood"),
c("leaf_reflect_vis", "leaf_reflect_nir"),
con = con
)
# With `expand = FALSE`, search the first trait for the first PFT,
# the second trait for the second PFT, etc. Note that this means
# PFT and trait input vectors must be the same length.
pdat2 <- query_priors(
c("Optics.Temperate_Early_Hardwood",
"Optics.Temperate_Early_Hardwood",
"Optics.Temperate_Mid_Hardwood",
"Optics.Temperate_Late_Hardwood"),
c("leaf_reflect_vis",
"leaf_reflect_nir",
"leaf_reflect_vis",
"leaf_reflect_nir"),
con = con
)
} # }