Learn R Programming

dataRetrieval (version 2.1.2)

readNWISdata: General Data Import from NWIS

Description

Returns data from the NWIS web service. Arguments to the function should be based on http://waterservices.usgs.gov service calls.

Usage

readNWISdata(service = "dv", ...)

Arguments

service
string. Possible values are "iv" (for instantaneous), "dv" (for daily values), "gwlevels" (for groundwater levels), and "site" (for site service)

Value

A data frame with the following columns:
Name Type
Description agency
character The NWIS code for the agency reporting the data
site character
The USGS site number datetime
POSIXct The date and time of the value converted to UTC (for unit value data),
character
or raw character string tz_cd
character The time zone code for datetime
code character
Any codes that qualify the corresponding value value
numeric The numeric value for the parameter
Note that code and value are repeated for the parameters requested. The names are of the form X_D_P_S, where X is literal, D is an option description of the parameter, P is the parameter code, and S is the statistic code (if applicable).There are also several useful attributes attached to the data frame:
Name Type
Description url
character The url used to generate the data
siteInfo data.frame
A data frame containing information on the requested sites variableInfo
data.frame A data frame containing information on the requested parameters
statisticInfo data.frame
A data frame containing information on the requested statistics on the data queryTime
POSIXct The time the data was returned

See Also

renameNWISColumns, importWaterML1, importRDB1

Examples

Run this code
## Not run: 
# # Examples not run for time considerations
# dataTemp <- readNWISdata(stateCd="OH",parameterCd="00010")
# dataTempUnit <- readNWISdata(sites="03086500", service="iv", parameterCd="00010")
# #Empty:
# multiSite <- readNWISdata(sites=c("04025000","04072150"), service="iv", parameterCd="00010")
# #Not empty:
# multiSite <- readNWISdata(sites=c("04025500","040263491"), service="iv", parameterCd="00060")
# bBoxEx <- readNWISdata(bBox=c(-83,36.5,-81,38.5), parameterCd="00010")
# 
# startDate <- as.Date("2013-10-01")
# endDate <- as.Date("2014-09-30")
# waterYear <- readNWISdata(bBox=c(-83,36.5,-81,38.5), parameterCd="00010",
#                   service="dv", startDate=startDate, endDate=endDate)
# siteInfo <- readNWISdata(stateCd="WI", parameterCd="00010",
#                   hasDataTypeCd="iv", service="site")
# ## End(Not run)

Run the code above in your browser using DataLab