From f39769f1f7b97629e506d03442bd31e76cf3c319 Mon Sep 17 00:00:00 2001
From: unknown <ldecicco@usgs.gov>
Date: Tue, 4 Nov 2014 12:50:18 -0600
Subject: [PATCH] Added timezone argument.

---
 R/readNWISqw.r    | 9 +++++++--
 man/readNWISqw.Rd | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/R/readNWISqw.r b/R/readNWISqw.r
index 26f42176..0e81537e 100644
--- a/R/readNWISqw.r
+++ b/R/readNWISqw.r
@@ -12,6 +12,10 @@
 #' remark_cd (remark code), result_va (result value), val_qual_tx (result value qualifier code), meth_cd (method code),
 #' dqi_cd (data-quality indicator code), rpt_lev_va (reporting level), and rpt_lev_cd (reporting level type).
 #' @param reshape logical. Will reshape the data if TRUE (default)
+#' @param tz string to set timezone attribute of datetime. Default is an empty quote, which converts the 
+#' datetimes to UTC (properly accounting for daylight savings times based on the data's provided tz_cd column).
+#' Possible values to provide are "America/New_York","America/Chicago", "America/Denver","America/Los_Angeles",
+#' "America/Anchorage","America/Honolulu","America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla"
 #' @keywords data import USGS web service
 #' @return data dataframe with agency, site, dateTime, value, and code columns
 #' @export
@@ -28,11 +32,12 @@
 #'           startDate,endDate,expanded=TRUE)
 #' rawNWISqwDataExpand <- readNWISqw(siteNumber,pCodes,
 #'           startDate,endDate,expanded=TRUE,reshape=FALSE)
-readNWISqw <- function (siteNumber,pCodes,startDate,endDate,expanded=FALSE,reshape=TRUE){  
+readNWISqw <- function (siteNumber,pCodes,startDate="",endDate="",
+                        expanded=FALSE,reshape=TRUE,tz=""){  
   
   url <- constructNWISURL(siteNumber,pCodes,startDate,endDate,"qw",expanded=expanded)
   
-  data <- importRDB1(url,asDateTime=TRUE, qw=TRUE)
+  data <- importRDB1(url,asDateTime=TRUE, qw=TRUE, tz = tz)
   
   if(reshape & expanded){
     columnsToMelt <- c("agency_cd","site_no","sample_dt","sample_tm",
diff --git a/man/readNWISqw.Rd b/man/readNWISqw.Rd
index 0d16d618..701d02f0 100644
--- a/man/readNWISqw.Rd
+++ b/man/readNWISqw.Rd
@@ -3,8 +3,8 @@
 \alias{readNWISqw}
 \title{Raw Data Import for USGS NWIS QW Data}
 \usage{
-readNWISqw(siteNumber, pCodes, startDate, endDate, expanded = FALSE,
-  reshape = TRUE)
+readNWISqw(siteNumber, pCodes, startDate = "", endDate = "",
+  expanded = FALSE, reshape = TRUE, tz = "")
 }
 \arguments{
 \item{siteNumber}{string or vector of of USGS site numbers.  This is usually an 8 digit number}
@@ -20,6 +20,11 @@ remark_cd (remark code), result_va (result value), val_qual_tx (result value qua
 dqi_cd (data-quality indicator code), rpt_lev_va (reporting level), and rpt_lev_cd (reporting level type).}
 
 \item{reshape}{logical. Will reshape the data if TRUE (default)}
+
+\item{tz}{string to set timezone attribute of datetime. Default is an empty quote, which converts the
+datetimes to UTC (properly accounting for daylight savings times based on the data's provided tz_cd column).
+Possible values to provide are "America/New_York","America/Chicago", "America/Denver","America/Los_Angeles",
+"America/Anchorage","America/Honolulu","America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla"}
 }
 \value{
 data dataframe with agency, site, dateTime, value, and code columns
-- 
GitLab