This R package is designed to obtain USGS or EPA water quality sample data, streamflow data, and metadata directly from web services. See: http://usgs-r.github.io/dataRetrieval/
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/",
warning = FALSE,
message = FALSE,
fig.height = 7,
fig.width = 7
)
library(dataRetrieval)
The dataRetrieval
package was created to simplify the process of loading hydrologic data into the R environment. It is designed to retrieve the major data types of U.S. Geological Survey (USGS) hydrology data that are available on the Web, as well as data from the Water Quality Portal (WQP), which currently houses water quality data from the Environmental Protection Agency (EPA), U.S. Department of Agriculture (USDA), and USGS. Direct USGS data is obtained from a service called the National Water Information System (NWIS).
⚠️ USGS discrete water-quality data availability and format are changing. Beginning March 11, 2024 USGS data obtained from legacy services will not include new USGS data or recent updates to existing data. To view the status of changes in data availability and code functionality, visit: https://doi-usgs.github.io/dataRetrieval/articles/Status.html
⚠️ All documentation on https://doi-usgs.github.io/dataRetrieval assume you have the development version of dataRetrieval installed. To do that:
library(remotes)
install_github("DOI-USGS/dataRetrieval",
build_vignettes = TRUE,
build_opts = c("--no-resave-data",
"--no-manual"))
If you have additional questions about these changes, email [email protected].
Get instantaneous USGS discharge data. Start here: ?readNWISuv
Get daily USGS discharge data. Start here: ?readNWISdv
Get USGS groundwater data. Start here: ?readNWISgwl
Get discrete water quality data. Start here: ?readWQPdata
Discover USGS data (not including discrete water quality data). Start here: ?whatNWISdata
Find Hydro Network-Linked Data Index (NLDI) data. Start here: ?findNLDI
For additional tutorials, see:
To install the dataRetrieval
package, you must be using R 3.0 or greater and run the following command:
install.packages("dataRetrieval")
To get cutting-edge changes, install from GitHub using the remotes
packages:
library(remotes)
install_github("DOI-USGS/dataRetrieval",
build_vignettes = TRUE,
build_opts = c("--no-resave-data",
"--no-manual"))
Please consider reporting bugs and asking questions on the Issues page:
https://github.com/DOI-USGS/dataRetrieval/issues
citation(package = "dataRetrieval")
U.S. Geological Survey, 2023, National Water Information System data available on the World Wide Web (USGS Water Data for the Nation), accessed [April 26, 2023], at http://waterdata.usgs.gov/nwis/. http://dx.doi.org/10.5066/F7P55KJN
This can be done using the create_NWIS_bib
function:
dv <- readNWISdv("09010500", "00060")
NWIScitation <- create_NWIS_bib(dv)
NWIScitation
print(NWIScitation, style = "Bibtex")
Citations for specific datasets should use this format:
National Water Quality Monitoring Council, YYYY, Water Quality Portal, accessed mm, dd, yyyy, hyperlink_for_query, https://doi.org/10.5066/P9QRKUVJ.
This can be done using the create_WQP_bib
function:
SC <- readWQPqw(siteNumbers = "USGS-05288705",
parameterCd = "00300")
WQPcitation <- create_WQP_bib(SC)
WQPcitation
print(WQPcitation, style = "Bibtex")
General Water Quality Portal citations should use the following:
Water Quality Portal. Washington (DC): National Water Quality Monitoring Council, United States Geological Survey (USGS), Environmental Protection Agency (EPA); 2021. https://doi.org/10.5066/P9QRKUVJ.
The Water Mission Area of the USGS supports the development and maintenance of dataRetrieval
, and most likely further into the future. Resources are available primarily for maintenance and responding to user questions. Priorities on the development of new features are determined by the dataRetrieval
development team. This software was last released with USGS record: IP-147158.