Skip to content

Commit

Permalink
validate 'by' arguments in predLoad and predConc
Browse files Browse the repository at this point in the history
  • Loading branch information
wdwatkins committed Aug 18, 2017
1 parent 48b5e82 commit 0cbb8a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions R/predConc.R
Expand Up @@ -43,13 +43,17 @@
#' @export
predConc <- function(fit, newdata, by="day",
allow.incomplete=FALSE, conf.int=0.95) {
##

## By options and other preliminary code
if(is.null(fit$cfit))
if(is.null(fit$cfit)) {
stop("model cannot predict concentration values")
if(nrow(newdata) > 176000L)
}

if(nrow(newdata) > 176000L) {
stop("newdata has too many rows, the size limit is 176000")
}
ByOpt <- c("unit", "day")
match.arg('by', ByOpt)
Qadj <- fit$Qadj
Tadj <- fit$Tadj
flow <- fit$flow
Expand Down
4 changes: 3 additions & 1 deletion R/predLoad.R
Expand Up @@ -64,9 +64,11 @@ predLoad <- function(fit, newdata, load.units=fit$load.units, by="total",
## 2014Sep23 DLLorenz Missing check on newdata
##
## By options and other preliminary code
if(nrow(newdata) > 176000L)
if(nrow(newdata) > 176000L) {
stop("newdata has too many rows, the size limit is 176000")
}
ByOpt <- c("unit", "day", "month", "water year", "calendar year", "total")
match.arg(by, ByOpt)
load.units
seopt <- match.arg(seopt, c("exact", "approximate"))
Qadj <- fit$Qadj
Expand Down

0 comments on commit 0cbb8a8

Please sign in to comment.