read.janus: Submits a query to JANUS database

read.janusR Documentation

Submits a query to JANUS database

Description

Submits a query to JANUS database view JANUS_ELEMENT using arbitrary tag=value query parameters.

Usage

read.janus(
  ...,
  start = NULL,
  end = NULL,
  what = c("data", "location"),
  server = NULL,
  date.field = "sample_end_time",
  as.text = T,
  simple = F
)

read.janus.location(..., server = NULL, as.sf = TRUE)

Arguments

...

query arguments in the form 'field = value'.

start

start date of data range

end

end date of data range

what

whether to return data or locations only. start and end are ignored if locations

date.field

the field used for the start and end query arguments.

as.text

logical, return a text (TRUE) or numeric (FALSE) nondetect indicator in column 'nd'.

dsn

the dsn for the JANUS database on the current system

Details

The user running R must have permission to access the database view and must have a ODBC Data Source set up for the view on the current computer. The reporting server version of the table is currently BESREPORTS.WATERSHED.JANUS_ELEMENT. In addition, different ODBC connections must be set up for 32 and 64 bit versions of R. The RODBC::odbcDataSources() function can be used to check the currently available data sources from within R.

Value

a dataframe of results

Author(s)

Jason Law jason.law@portlandoregon.gov

Examples

## Not run: 
#List the available fields
library(RODBC)
con <- BESdata:::dbConnect("JANUS")
sqlColumns(con, 'JANUS_ELEMENT')
#Get the last 2 weeks of data
read.janus(start = Sys.Date() - 14)

## End(Not run)

jasonelaw/BESdata documentation built on Nov. 3, 2023, 9:32 a.m.