From 7f820677fc0661f6d3bae82747043b8e7f0c095c Mon Sep 17 00:00:00 2001
From: Laura DeCicco <ldecicco@usgs.gov>
Date: Mon, 9 Nov 2015 14:50:57 -0600
Subject: [PATCH] Couple updates to readNWISpeak to add Dates and numeric to
 some columns.

---
 R/readNWISunit.r    | 9 ++++++---
 man/readNWISpeak.Rd | 6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/R/readNWISunit.r b/R/readNWISunit.r
index 1c6957d9..201f6177 100644
--- a/R/readNWISunit.r
+++ b/R/readNWISunit.r
@@ -101,10 +101,10 @@ readNWISuv <- function (siteNumbers,parameterCd,startDate="",endDate="", tz=""){
 #' 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 character \tab Peak streamflow reported is the highest since this year \cr
-#' ag_dt \tab character \tab Date of maximum gage-height for water year (if not concurrent with peak) \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 character \tab maximum Gage height for water year in feet (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
 #' }
 #' 
@@ -142,8 +142,11 @@ readNWISpeak <- function (siteNumbers,startDate="",endDate="", asDateTime=TRUE){
         }
       }
       data$peak_dt <- as.Date(data$peak_dt)
+      data$ag_dt <- as.Date(data$ag_dt)
     }
     data$gage_ht <- as.numeric(data$gage_ht)
+    data$ag_gage_ht <- as.numeric(data$ag_gage_ht)
+    data$year_last_pk <- as.numeric(data$year_last_pk)
     
     siteInfo <- readNWISsite(siteNumbers)
     siteInfo <- left_join(unique(data[,c("agency_cd","site_no")]),siteInfo, by=c("agency_cd","site_no"))
diff --git a/man/readNWISpeak.Rd b/man/readNWISpeak.Rd
index d6753d40..548cb93d 100644
--- a/man/readNWISpeak.Rd
+++ b/man/readNWISpeak.Rd
@@ -30,10 +30,10 @@ 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 character \tab Peak streamflow reported is the highest since this year \cr
-ag_dt \tab character \tab Date of maximum gage-height for water year (if not concurrent with peak) \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 character \tab maximum Gage height for water year in feet (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
 }
 
-- 
GitLab