Description Usage Arguments Details Value Examples
The function odm_read can be used to get data from ODM database. ODMselect returns a data frame containing the required columns for working with ODM data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
utc_offset |
of the observation |
site_id |
index value for the location at which the observation was made |
variable_id |
index value for the variable that the data represents |
qualifier_id |
of the observations you want to extract |
method_id |
index value for the method used to collect the observation |
source_id |
the source of the data |
level_id |
the level of quality control processing |
aggregate_by |
aggregation level to include in SQL query. Either hour, day, month, year or none |
FUN |
function to aggregate by. Either min, max, mean, or sum |
start_date |
access data from this date forward |
end_date |
access data up to this date |
n |
maximum number of observations to return |
channel |
connection handle as returned by odbcConnect |
A standard SQL query is issued to the ODM database and the values are returned. The data returned can be limited by a start and/or end date defined by the user. Smaller datasets can speed up the workflow especially when visualising data.
A data frame
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
# Establish connection with database
ODM <- odbc::dbConnect(odbc::odbc(), dsn = "ODM", database = "OD",
UID = "update", PWD = rstudioapi::askForPassword("Database password"),
Port = 1433)
# Extract data by site, variable, method and QC level. Clear and consistent
# method to extract data.
Data <- odm_read(site_id = 1, variable_id = 1, method_id = 9,
level_id = 0, start_date = "2013-06-01",
end_date = "2013-07-01", channel = ODM)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.