CHMselect: Query DESC chemistry database

Description Usage Arguments Value Examples

Description

The function CHMselect can be used to get data from the DESC chemistry database. A standard SQL query is issued to the database and the values are returned in dataframe. The data returned can be limited by a start and/or end date defined by the user.

Usage

1
2
CHMselect(channel, STATION = NULL, LDESC = NULL, TEST_NAME = NULL,
  SUBNUM = NULL, startDate = "1970-01-1 00:00:00", endDate = Sys.Date())

Arguments

channel

connection handle as returned by odbcConnect

STATION

station number

LDESC

location description given during sample submissions

TEST_NAME

the test name short form found in the lab submission manual

SUBNUM

submission number

startDate

access data from this date forward

endDate

access data up to this date

Value

A data frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Establish connection with database
CHM = odbcConnect("Connection", "User id", "Password")

# Extract all data by STATION
tmp <- CHMselect(CHM, STATION = '03008557402')

# Extract data by STATION and multiple TEST_NAME.
tmp = CHMselect(CHM, STATION = '03008557402', TEST_NAME = c('PPUT1','PPUT2'))

# Limit extraction by date.
tmp = CHMselect(CHM, STATION = '03008557402', TEST_NAME = 'PPUT1',
 startDate = "2015-09-01", endDate = "2015-11-01")

D-ESC/CHMr documentation built on May 6, 2019, 12:54 p.m.