From ede68d527b7c5fec15ae7963b777b08f7635a1c3 Mon Sep 17 00:00:00 2001 From: unknown <ldecicco@usgs.gov> Date: Wed, 3 Dec 2014 08:39:08 -0600 Subject: [PATCH 1/3] Changed readWQP to not bother with attributes. --- DESCRIPTION | 6 +++--- R/readWQPSample.R | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0d4ec185..61e42430 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,14 +7,14 @@ Authors@R: c( person("Robert", "Hirsch", role = c("aut"), email = "rhirsch@usgs.gov"), person("Laura", "DeCicco", role = c("aut","cre"), email = "ldecicco@usgs.gov")) -Description: EGRET includes statistics and graphics for streamflow history, - water quality trends, and the statistical modeling algorithm Weighted +Description: Statistics and graphics for streamflow history, + water quality trends, and the statistical modeling algorithm: Weighted Regressions on Time, Discharge, and Season (WRTDS). License: CC0 Depends: R (>= 3.0) Imports: - dataRetrieval, + dataRetrieval (>= 2.0.1), survival, fields, stats, diff --git a/R/readWQPSample.R b/R/readWQPSample.R index 590f6a82..9ea72514 100644 --- a/R/readWQPSample.R +++ b/R/readWQPSample.R @@ -38,10 +38,9 @@ #' } readWQPSample <- function(siteNumber,characteristicName,startDate,endDate,interactive=TRUE){ - retval <- readWQPqw(siteNumbers=siteNumber, - parameterCd=characteristicName, - startDate=startDate, - endDate=endDate) + url <- constructWQPURL(siteNumber,characteristicName,startDate,endDate) + data <- importWQP(url) + #Check for pcode: if(all(nchar(characteristicName) == 5)){ suppressWarnings(pCodeLogic <- all(!is.na(as.numeric(characteristicName)))) -- GitLab From b6fa69825d4aafa5684150fb79e03e87ad540341 Mon Sep 17 00:00:00 2001 From: unknown <ldecicco@usgs.gov> Date: Wed, 3 Dec 2014 08:43:13 -0600 Subject: [PATCH 2/3] Fix a mistake in the new function. --- R/readWQPSample.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/readWQPSample.R b/R/readWQPSample.R index 9ea72514..db812e7f 100644 --- a/R/readWQPSample.R +++ b/R/readWQPSample.R @@ -39,7 +39,7 @@ readWQPSample <- function(siteNumber,characteristicName,startDate,endDate,interactive=TRUE){ url <- constructWQPURL(siteNumber,characteristicName,startDate,endDate) - data <- importWQP(url) + retval <- importWQP(url) #Check for pcode: if(all(nchar(characteristicName) == 5)){ -- GitLab From a2825ff870979b4869f85b63a51401edfc14e661 Mon Sep 17 00:00:00 2001 From: unknown <ldecicco@usgs.gov> Date: Wed, 3 Dec 2014 09:21:04 -0600 Subject: [PATCH 3/3] Added na check in processQWData --- R/processQWData.r | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/processQWData.r b/R/processQWData.r index cfc41646..29d756c2 100644 --- a/R/processQWData.r +++ b/R/processQWData.r @@ -21,7 +21,9 @@ processQWData <- function(data,pCode=TRUE){ qualifier <- ifelse((data$ResultDetectionConditionText == "Not Detected" | data$ResultDetectionConditionText == "Detected Not Quantified" | - data$ResultMeasureValue < data$DetectionQuantitationLimitMeasure.MeasureValue),"<","") + (!is.na(data$DetectionQuantitationLimitMeasure.MeasureValue) & + data$ResultMeasureValue < data$DetectionQuantitationLimitMeasure.MeasureValue)), + "<","") correctedData<-ifelse((nchar(qualifier)==0),data$ResultMeasureValue,data$DetectionQuantitationLimitMeasure.MeasureValue) test <- data.frame(data$USGSPCode) -- GitLab