get_localNWIS: get_localNWIS. Pulls data from NWIS internal servers using...

Description Usage Arguments Details Value Examples

View source: R/get_localNWIS.R

Description

get_localNWIS. Pulls data from NWIS internal servers using ODBC connection and returns a longtable (by result)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
get_localNWIS(
  DSN,
  env.db = "01",
  qa.db = "02",
  STAIDS,
  begin.date = NA,
  end.date = NA,
  projectCd = NULL,
  resultAsText = FALSE,
  approval = "All"
)

Arguments

DSN

A character string containing the DSN for your local server

env.db

A character string containing the database number of environmental samples

qa.db

A character string containing the database number of QA samples

STAIDS

A character vector of stations IDs. Agency code defaults to "USGS" unless appended to the beginning of station ID with a dash, e.g. "USGS-123456".

begin.date

Character string containing beginning date of data pull (yyyy-mm-dd)

end.date

Character string containing ending date of data pull (yyyy-mm-dd)

projectCd

Character vector containing project codes to subset data by.

resultAsText

Output results as character instead of numeric. Used for literal output of results from NWIS that are no affected by class coerrcion, such as dropping zeros after decimal point. Default is False.

approval

A character string indicating which DQI samples to pull.
Default is 'All', which includes approved, rejected, and in-review samples.
Other options are:
"Rejected" which pulls only samples with DQI = "Q","X", or "U".
"Non-rejected" which includes any historical, approved, provisional, and in-review samples.

Details

NWIS parameter groups are as follows: All = "All", physical = "PHY", cations = "INM", anions = "INN", nutrients = "NUT", microbiological = "MBI", biological = "BIO", metals = "IMM", nonmetals = "IMN", pesticides = "TOX", pcbs="OPE", other organics = "OPC", radio chemicals = "RAD", stable isotopes = "XXX", sediment = "SED", population/community = "POP"

Value

Returns a dataframe of samples. The longTable format contains all data pulled from NWIS along with all assosciated metadata in by-result format. For a wideTable containing all data pulled from NWIS in wide (sample-result) format, an easier format for import into spreadsheet programs, use the make_wideTable function Dataframe names will be changed to more appropriate values in future package updates.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
#Will not run unless connected to NWISCO
qw.data <- get_localNWIS(DSN="NWISCO",
                             env.db = "01",
                             qa.db = "02",
                             STAIDS = c("06733000","09067005"),
                             begin.date = "2005-01-01",
                             end.date = "2015-10-27",
                             projectCd = NULL,
                             resultAsText = FALSE,
                             approval = 'All')

## End(Not run)

USGS-R/sedReview documentation built on Aug. 24, 2020, 9 p.m.