% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/readNWISunit.R
\name{readNWISpeak}
\alias{readNWISpeak}
\title{Peak flow data from USGS (NWIS)}
\usage{
readNWISpeak(
  siteNumbers,
  startDate = "",
  endDate = "",
  asDateTime = TRUE,
  convertType = TRUE
)
}
\arguments{
\item{siteNumbers}{character USGS site number(or multiple sites).  This is usually
an 8 digit number.}

\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD.
Default is "" which indicates
retrieval for the earliest possible record.}

\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD.
Default is "" which indicates
retrieval for the latest possible record.}

\item{asDateTime}{logical default to \code{TRUE}. When \code{TRUE}, the peak_dt column is converted
to a Date object, and incomplete dates are removed. When \code{FALSE}, no
columns are removed, but no dates are converted.}

\item{convertType}{logical, defaults to \code{TRUE}. If \code{TRUE}, the function
will convert the data to dates, datetimes,
numerics based on a standard algorithm. If false, everything is returned as a character}
}
\value{
A data frame with the following columns:
\tabular{lll}{
Name \tab Type \tab Description \cr
agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr
site_no \tab character \tab The USGS site number \cr
peak_dt \tab Date \tab Date of peak streamflow \cr
peak_tm \tab character \tab Time of peak streamflow as character \cr
peak_va \tab numeric \tab Annual peak streamflow value in cfs \cr
peak_cd \tab character \tab Peak Discharge-Qualification codes (see \code{comment}
for more information) \cr
gage_ht \tab numeric \tab Gage height for the associated peak streamflow in feet \cr
gage_ht_cd \tab character \tab Gage height qualification codes \cr
year_last_pk \tab numeric \tab Peak streamflow reported is the highest since this year \cr
ag_dt \tab Date \tab Date of maximum gage-height for water year
(if not concurrent with peak) \cr
ag_tm \tab character \tab Time of maximum gage-height for water year
(if not concurrent with peak) \cr
ag_gage_ht \tab numeric \tab maximum Gage height for water year in feet
(if not concurrent with peak) \cr
ag_gage_ht_cd \tab character \tab maximum Gage height code \cr
}

There are also several useful attributes attached to the data frame:
\tabular{lll}{
Name \tab Type \tab Description \cr
url \tab character \tab The url used to generate the data \cr
queryTime \tab POSIXct \tab The time the data was returned \cr
comment \tab character \tab Header comments from the RDB file \cr
siteInfo \tab data.frame \tab A data frame containing information on the requested sites \cr
}
}
\description{
Reads peak flow from NWISweb.
}
\details{
In some cases, the specific date of the peak data is not know. This function
will default to
converting complete dates to a "Date" object, and converting incomplete dates to
"NA". If those incomplete dates are
needed, set the \code{asDateTime} argument to FALSE. No dates will be converted to
R Date objects.
}
\examples{
\dontshow{if (is_dataRetrieval_user()) withAutoprint(\{ # examplesIf}
#site_ids <- c("01594440", "040851325")
\donttest{
#data <- readNWISpeak(site_ids)
#data2 <- readNWISpeak(site_ids, asDateTime = FALSE)
#stations <- c("06011000")
#peakdata <- readNWISpeak(stations, convertType = FALSE)
}
\dontshow{\}) # examplesIf}
}
\seealso{
\code{\link[=constructNWISURL]{constructNWISURL()}}, \code{\link[=importRDB1]{importRDB1()}}
}
