odm_delete: Delete records from ODM database

Description Usage Arguments Details Examples

View source: R/odm_delete.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# 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)
 
## End(Not run)

D-ESC/ODMr documentation built on Sept. 16, 2021, 10:52 a.m.