query | R Documentation |
query
retrieves data from NAMC given a specified API endpoint
name.
query(
api_endpoint,
args = list(),
include = c(),
exclude = c(),
filter = list(),
sort = c(),
limit = NA,
api = .pkgenv$api,
expand_metadata = TRUE,
default_JSON_fieldName = .pkgenv$data$default_JSON_fieldName,
...
)
api_endpoint |
string A NAMC API endpoint name. Available endpoints can
be found via the |
args |
a list of named arguments to pass to the API endpoint. Can also be passed individually in ... |
include |
is a vector of fields to include from the endpoint. |
exclude |
is a vector of fields to exclude from the endpoint. |
filter |
list A list containing filter parameters. |
sort |
list A list containing fields / directions to sort by. |
limit |
numeric The number of results desired. |
api |
namc_api An instance of the namc_api class having a default of a pre-initialized package object |
expand_metadata |
logical if JSON metadata field is expanded into dataframe columns |
default_JSON_fieldName |
"metadata" is the preset default |
... |
named arguments to merge with args and pass to the API endpoint. |
Providing a desired endpoint and filtering the function retrieves data from the NAMC database. If not already authenticated the will trigger the authentication / account creation routines. By default all fields are included. Use include and exclude arguments to limit returned fields.
data.frame A dataframe containing the query results.
info()
,browseVignettes("NAMC-API-Overview")
Other query functions:
raw_query()
,
save()
sites = NAMCr::query(
api_endpoint = 'sites',
include = c('station','lat','long')),
filter = list(
station = c('station1','station2'),
lat = list(
data = c(42,46),
type = 'between'
)
)
sort = c('station','lat'),
limit = 50
)
# View full API docs in console
NAMCr::info()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.