View source: R/npn_data_download.R
npn_get_data_by_year | R Documentation |
Utility function to chain multiple requests to npn_get_data for requests where data should only be retrieved on an annual basis, or otherwise automatically be delineated in some way. Results in a data table that's a combined set of the results from each request to the data service.
npn_get_data_by_year(
endpoint,
query,
years,
period_start = "01-01",
period_end = "12-31",
download_path = NULL,
six_leaf_layer = FALSE,
six_bloom_layer = FALSE,
agdd_layer = NULL,
six_sub_model = NULL,
additional_layers = NULL
)
endpoint |
String, the endpoint to query. |
query |
Base query string to use. This includes all the user selected parameters but doesn't include start/end date which will be automatically generated and added. |
years |
Integer vector; the years for which to retrieve data. There
will be one request to the service for each year. If the period
(determined by |
period_start , period_end |
Character vectors of the form "MM-DD". Used to
determine the period over which phenophase status records are summarized.
For example, to use a "water year" set |
download_path |
Character, optional file path to the file for which to output the results. |
six_leaf_layer |
Boolean value when set to |
six_bloom_layer |
Boolean value when set to |
agdd_layer |
Numeric value, accepts |
six_sub_model |
Affects the results of the six layers returned. Can be
used to specify one of three submodels used to calculate the spring index
values. Thus setting this field will change the results of |
additional_layers |
Data frame with first column named |
A tibble combining each requests results from the service. If
download_path
is specified, the file path is returned instead.
## Not run:
endpoint <- "/observations/getObservations.json"
query <- list(
request_src = "Unit%20Test",
climate_data = "0",
`species_id[1]` = "6"
)
npn_get_data_by_year(endpoint = endpoint,
query = query,
years = c(2013, 2014))
#Set a custom period from October through September
# This will return data for 2013-10-01 through 2014-09-30 and from 2014-10-01
# through 2015-09-30
npn_get_data_by_year(
endpoint = endpoint,
query = query,
years = c(2013, 2014),
period_start = "10-01",
period_end = "09-30"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.