The function odm_delete can be used to delete data from ODM database.

odm_delete(site_id, variable_id, method_id, level_id, source_id = 1,
  start_date = "1970-01-1 00:00:00", end_date = Sys.Date(),
  channel = ODM)

Arguments

site_id

index value for the location at which the observation was made

variable_id

index value for the variable that the data represents

method_id

index value for the method used to collect the observation

level_id

the level of quality control processing

source_id

index value for the source of the observation

start_date

access data from this date forward

end_date

access data up to this date

channel

connection handle as returned by odbcConnect

Details

A standard SQL query is issued to the ODM database and the values are removed. The data deleted can be limited by a start and/or end date defined by the user.

Examples

if (FALSE) { # Establish connection with database ODM <- odbc::dbConnect(odbc::odbc(), dsn = "ODM", database = "OD", UID = "update", PWD = rstudioapi::askForPassword("Database password"), Port = 1433) # Delete data by site, variable, method and QC level. odm_delete(site_id = 1, variable_id = 1, method_id = 9, level_id = 0, start_date = "2013-06-01", end_date = "2013-07-01", channel = ODM) }