Skip to content
R package to interface to Canadian Hydrometric Data (HYDAT) published by Water Survey of Canada
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.


R package for reading from WSC HYDAT databases

Installation instructions


HYDAT depends on several other packages, which you need to install first, from CRAN, before installing HYDAT.

These packages are: reshape2, lubridate, DBI

In addition, you need to install the package RSQLite in order to actually use HYDAT.

Installing HYDAT

You can download the complete package, as well as the manual .pdf, by clicking on releases. However, you can download and install the most up-to-date version directly from this repository. The procedure is

  1. Install the package "devtools" - you only have to do this once. Note that this will also install several dependancies
  2. Load the devtools library
  3. Install the package.

The commands are:



Downloading data

HYDAT uses SQLite databases of hydrological data from Environment Canada. You can get the most recent database from Be sure to download the file named "" where YYYMMDD is the date of the file. Once the file is downloaded, extract the SQLite database file Hydat.sqlite3.

Using the HYDAT R commands

Getting HYDAT data in R takes 3 steps:

  1. Connecting to the HYDAT database
  2. Retrieving the data
  3. Closing the connection.

Steps 1 and 3 require commands from the RSQLite package; step 2 requires a HYDAT command. This example extracts daily flow values for a given station.

HYDATfile <- 'Hydat.sqlite3'
WSCstation <- '05HG001'  # South Sask. River at Saskatoon
HYDAT <- dbConnect(SQLite(), HYDATfile)

dailyvals <- DailyHydrometricData(con = HYDAT, 
               get_flow = TRUE, 
               station_number = WSCstation)

You can’t perform that action at this time.