R/insert-measurement-results.R
db_insert_results_m.RdInsert measurement data values to ODM2 database
db_insert_results_m(db, datavalues, methodcode, site_code_col = "site", variables, sampledmedium, processinglevel = "Raw data", aggregationstatistic = "Unknown", time_aggregation_interval = list(1, "Minute"), methodtypecv = "Instrument deployment", actionby = NULL, equipment_name = NULL, zlocation = NULL, zlocationunits = NULL, ...)
| db | database connection |
|---|---|
| datavalues | data frame with columns "Timestamp" with YYYY-MM-DD H:M:S format, and column names corresponding to variable names |
| methodcode | code for method used to collect data |
| site_code_col | name of column with site codes. defaults to "site" |
| variables | a named list of lists defining variable names, units, and columns in
datavalues data frame. Create with |
| sampledmedium | term from controlled vocabulary for medium sampled eg. air or soil |
| processinglevel | code for processing level. will be added to processinglevels table if new. defaults to "Raw data'. |
| aggregationstatistic | controlled vocabulary, defaults to unknown |
| time_aggregation_interval | defaults to unknown |
| methodtypecv | term from controlled vocabulary, defaults to instrument deployment |
| actionby | (optional) the person who performed the action |
| equipment_name | (optional) the equipment used to collect the data |
| zlocation | (optional) z location offset |
| zlocationunits | (optional but required if zlocation is set) name of units of z location offset |
| ... | parameters to pass to various db_describe_ functions |
true if successful
Other insert data functions: db_insert_results_samples_profile,
db_insert_results_samples,
db_insert_results_ts
# NOT RUN { # make database and data frame db <- rodm2::create_sqlite(connect = TRUE) mrv <- data.frame(Timestamp = "2018-06-27 13:55:00", "vwc" = 68.3, site = "BB2") db_insert_results_m(db = db, datavalues = mrv, methodcode = "soilmoisture", site_code_col = "site", variables = list("Volumetric water content" = list("vwc"," Percent")), sampledmedium = "Soil") # }