5.1 Load Data and Packages
5.1.2 Dataset
We will be looking at the daily discharge of the Rio Grande, which has been measured at Embudo, NM since 1889. The data and their associated metadata may be retrieved from the USGS website. Let’s load them and have a look:
df <- read.table('https://waterdata.usgs.gov/nwis/dv?cb_00060=on&format=rdb&site_no=08279500&legacy=&referred_module=sw&period=&begin_date=1889-01-01&end_date=2024-05-20', skip=35, sep="\t")
names(df) <- c('agency', 'site_no', 'datetime','discharge (cf/s)','code')
df$datetime <- lubridate::as_datetime(df$datetime)
head(df)## agency site_no datetime discharge (cf/s) code
## 1 USGS 8279500 1889-01-05 413 A
## 2 USGS 8279500 1889-01-06 408 A
## 3 USGS 8279500 1889-01-07 410 A
## 4 USGS 8279500 1889-01-08 405 A
## 5 USGS 8279500 1889-01-09 379 A
## 6 USGS 8279500 1889-01-10 418 A