Skip Links

USGS - science for a changing world

Techniques and Methods Report 4–A10

User Guide to Exploration and Graphics for RivEr Trends (EGRET) and dataRetrieval: R Packages for Hydrologic Data

By Robert M. Hirsch and Laura A. De Cicco

Thumbnail of and link to report PDF (6.27 MB)Abstract

Evaluating long-term changes in river conditions (water quality and discharge) is an important use of hydrologic data. To carry out such evaluations, the hydrologist needs tools to facilitate several key steps in the process: acquiring the data records from a variety of sources, structuring it in ways that facilitate the analysis, processing the data with routines that extract information about changes that may be happening, and displaying findings with graphical techniques. A pair of tightly linked R packages, called dataRetrieval and EGRET (Exploration and Graphics for RivEr Trends), have been developed for carrying out each of these steps in an integrated manner. They are designed to easily accept data from three sources: U.S. Geological Survey hydrologic data, U.S. Environmental Protection Agency (EPA) STORET data, and user-supplied flat files. The dataRetrieval package not only serves as a “front end” to the EGRET package, it can also be used to easily download many types of hydrologic data and organize it in ways that facilitate many other hydrologic applications. The EGRET package has components oriented towards the description of long-term changes in streamflow statistics (high flow, average flow, and low flow) as well as changes in water quality. For the water-quality analysis, it uses Weighted Regressions on Time, Discharge and Season (WRTDS) to describe long-term trends in both concentration and flux. EGRET also creates a wide range of graphical presentations of the water-quality data and of the WRTDS results. This report serves as a user guide to these two R packages, providing detailed guidance on installation and use of the software, documentation of the analysis methods used, as well as guidance on some of the kinds of questions and approaches that the software can facilitate.

First posted October 8, 2014

Revised February 5, 2015

For additional information, contact:
Branch of Regional Research
Mail Stop 432
U.S. Geological Survey
12201 Sunrise Valley Drive
Reston, VA 20192

Part or all of this report is presented in Portable Document Format (PDF). For best results viewing and printing PDF documents, it is recommended that you download the documents to your computer and open them with Adobe Reader. PDF documents opened from your browser may not display or print as intended. Download the latest version of Adobe Reader, free of charge. More information about viewing, downloading, and printing report files can be found here.

Suggested citation:

Hirsch, R.M., and De Cicco, L.A., 2015, User guide to Exploration and Graphics for RivEr Trends (EGRET) and dataRetrieval: R packages for hydrologic data (version 2.0, February 2015): U.S. Geological Survey Techniques and Methods book 4, chap. A10, 93 p.,

ISSN 2328-7055 (online)




Data Entry

Setting the Period of Analysis for Graphs, Tables, and Analyses in EGRET

Selecting Units of Measurement for Graphs and Tables in EGRET

Flow History Analysis

Summarizing Water-Quality Data

WRTDS Analysis of Water-Quality Data

Editing Data Sets

Working with Multiple Versions of Data Frames

Batch Processing in EGRET

References Cited

Appendix 1. dataRetrieval Vignette

Appendix 2. EGRET Vignette

Appendix 3. Batch Workflows

Appendix 4. Sample Workflow

Accessibility FOIA Privacy Policies and Notices logo U.S. Department of the Interior | U.S. Geological Survey
Page Contact Information: Contact USGS
Page Last Modified: Friday, February 20, 2015, 10:15:18 AM