Skip to content

Commit

Permalink
Merge pull request #86 from ldecicco-USGS/master
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
ldecicco-USGS authored Jun 14, 2016
2 parents 0e173fc + 56c10be commit cac8a17
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: EGRET
Type: Package
Title: Exploration and Graphics for RivEr Trends (EGRET)
Version: 2.5.1
Version: 2.5.2
Authors@R: c( person("Robert", "Hirsch", role = c("aut"),
email = "rhirsch@usgs.gov"),
person("Laura", "DeCicco", role = c("aut","cre"),
Expand Down
4 changes: 2 additions & 2 deletions R/makeRandomResiduals.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#' rResid is the randomized residual value computed in log concentration units, and rObserved
#' is the randomized 'observed' value of concentration in concentration units.
#'
#' @param eList named list with at least the Daily dataframe
#' @param eList named list with at least the Sample dataframe
#' @keywords water-quality statistics
#' @importFrom truncnorm rtruncnorm
#' @export
#' @return eList named list with modified Daily data frame.
#' @return eList named list with modified Sample data frame.
makeAugmentedSample <- function(eList){

if(all(c("SE","yHat") %in% names(eList$Sample))){
Expand Down
30 changes: 21 additions & 9 deletions R/plotConcTime.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#' eList <- setPA(eList, paStart=6,paLong=3)
#' plotConcTime(eList, qUnit = 1, qLower = 100, qUpper = 10000)
#' plotConcTime(eList, logScale=TRUE)
#' plotConcTime(eList, qUnit = 1, qLower = 100, qUpper = 10000, rResid = TRUE)
plotConcTime<-function(eList, qUnit = 2,
qLower = NA, qUpper = NA, rResid=FALSE,
tinyPlot = FALSE, concMax = NA, concMin = NA, printTitle = TRUE,logScale=FALSE,
Expand Down Expand Up @@ -90,16 +91,10 @@ plotConcTime<-function(eList, qUnit = 2,
qText[3]<-paste("For Discharge <",qUpper,qUnit@qUnitName)
qText[4]<-paste("For Discharge between",qLower,"and",qUpper,qUnit@qUnitName)
title3<-qText[codeSum]
subSample<-subSample[subSample$Q>qLowerBound & subSample$Q<qUpperBound,]

subSample <- if(paLong == 12) subSample else selectDays(subSample, paLong,paStart)


# the next section of code sets up the seasonal part of the plot title
title2<-if(paLong==12) "" else setSeasonLabelByUser(paStartInput=paStart,paLongInput=paLong)

Uncen<-subSample$Uncen
x<-subSample$DecYear

#########################################################
if (logScale){
minYLow <- concMin
Expand All @@ -112,9 +107,15 @@ plotConcTime<-function(eList, qUnit = 2,

plotTitle<-if(printTitle) paste(localINFO$shortName,"\n",localINFO$paramShortName,"\n",title3,sep="") else ""

xInfo <- generalAxis(x=x, minVal=min(x), maxVal=max(x), tinyPlot=tinyPlot)

if(!rResid){
subSample<-subSample[subSample$Q>qLowerBound & subSample$Q<qUpperBound,]
subSample <- if(paLong == 12) subSample else selectDays(subSample, paLong,paStart)
Uncen<-subSample$Uncen
x<-subSample$DecYear

xInfo <- generalAxis(x=x, minVal=min(x), maxVal=max(x), tinyPlot=tinyPlot)

yLow<-subSample$ConcLow
yHigh<-subSample$ConcHigh

Expand All @@ -134,10 +135,21 @@ plotConcTime<-function(eList, qUnit = 2,
eList <- makeAugmentedSample(eList)
localSample <- eList$Sample
}
yHigh <- localSample$rObserved

subSample<-localSample
subSample$Q<-subSample$Q*qFactor

subSample<-subSample[subSample$Q>qLowerBound & subSample$Q<qUpperBound,]
subSample <- if(paLong == 12) subSample else selectDays(subSample, paLong,paStart)

Uncen<-subSample$Uncen
x<-subSample$DecYear

xInfo <- generalAxis(x=x, minVal=min(x), maxVal=max(x), tinyPlot=tinyPlot)
yHigh <- subSample$rObserved
yInfo <- generalAxis(x=yHigh, minVal=minYLow, maxVal=concMax, logScale=logScale,
tinyPlot=tinyPlot,units=attr(eList, "param.units"))

genericEGRETDotPlot(x=x[Uncen == 1], y=yHigh[Uncen == 1],
xlim=c(xInfo$bottom,xInfo$top), ylim=c(yInfo$bottom,yInfo$top),
xlab="", ylab=yInfo$label,
Expand Down
4 changes: 2 additions & 2 deletions man/makeAugmentedSample.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/plotConcTime.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cac8a17

Please sign in to comment.