import_flow | R Documentation |
import_flow
is a high-level function that calls import_nrfa
, import_hde
and import_flowfiles
to import data for a user-defined list of sites.
import_flow(sites = NULL, inputs = NULL, start_date = 1900-01-01, end_date = Sys.Date, dir = NULL, skip_num = NULL, col_order = NULL)
sites |
Vector of site (station) IDs to extract data for. |
inputs |
Vector of flow data inputs, must be either "NRFA", "HDE" or "FLOWFILES" |
start_date |
Start date for flow data extraction (YYYY-MM-DD format). Default = |
end_date |
End date for flow data extraction (YYYY-MM-DD format). Default = today's date. |
dir |
Path to local files. Ignored if |
skip_num |
For local files, defines the number of rows to skip before starting to read data. Ignored if |
col_order |
For local files, defines which columns contain the data of interest: |
date_format |
The order of the year (y), month (m), day (d), hour (h), minute (m) and second (s) elements in the flow file. Default = "dmy". See |
import_flow requires a list of site (station) ids (called sites
), and a corresponding list (called inputs
) specifying where to source the data for each site (either "NRFA", "HDE" or, for local files, "FLOWFILES"). sites
and inputs
must be of equal length. Any records where sites
or inputs
is NA are dropped.
If a sites
-inputs
combination is defined more than once, the duplicate(s) are ignored and a warning message is produced.
If a site id is listed twice, for two different inputs (e.g. NRFA and HDE), then the data will be imported from both sources and a warning message is produced.
A tibble containing daily flow data for the specified sites, with the following columns: input
("HDE", "NRFA" or "FLOWFILES"), flow_site_id
, date
, flow
and quality
.
# Import data for selected sites and dates
# import_flow(sites = c("F1707", "1001", "0130TH"),
# inputs = c("HDE", "NRFA", "FLOWFILES"),
# start_date = "2010-01-01",
# end_date = "2010-01-05",
# dir = "data/wiski",
# skip_num = 21,
# col_order = c(1,2,3))
# If no data to be imported from local files, then 'dir', 'skip_num', 'col_order' and date_format do not need to be specified
# import_flow(sites = c("F1707", "1001"),
# inputs = c("HDE", "NRFA"),
# start_date = "2010-01-01",
# end_date = "2010-01-05")
#
# Duplicate sites-inputs combinations are dropped.
# import_flow(sites = c("F1707", "1001", "1001"),
# inputs = c("HDE", "NRFA", "NRFA"),
# start_date = "2010-01-01",
# end_date = "2010-01-05")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.