20
20
# 'flow column.
21
21
# ' @param dates character string indicating the name of the
22
22
# 'date column.
23
- # ' @param flow.units character string describing the flow units.
23
+ # ' @param flow.units character string describing the flow units. See \bold{Details}.
24
24
# ' @param conc.units character string describing the concentration
25
- # 'unit.
26
- # ' @param load.units character string describing the load unit.
25
+ # 'unit. See \bold{Details}.
26
+ # ' @param load.units character string describing the load unit. See \bold{Details}.
27
27
# ' @param time.step character string describing the time step of
28
28
# 'the calibration data. Must be one of "instantaneous," "2 hours," "3 hours,"
29
29
# '"4 hours," "6 hours," "12 hours," or "day." The default is "day."
45
45
# ' station="Illinois River at Marseilles, Ill.")
46
46
# 'print(app1.lr)
47
47
# '
48
- # ' @import USGSwsQW
48
+ # ' @import smwrQW
49
49
# ' @export
50
50
loadReg <- function (formula , data , subset , na.action , flow , dates ,
51
51
flow.units = " cfs" , conc.units = " " , load.units = " kg" ,
@@ -62,6 +62,12 @@ loadReg <- function(formula, data, subset, na.action, flow, dates,
62
62
" 8 hours" , " 12 hours" , " day" ))
63
63
call <- match.call()
64
64
m <- match.call(expand.dots = FALSE )
65
+ Terms <- attr(m , " terms" )
66
+ # # Make sure that the formula is a formula and not a symbol--this
67
+ # improves output and subsequent formula references
68
+ if (typeof(call $ formula ) == " symbol" ) {
69
+ call $ formula <- formula(Terms )
70
+ }
65
71
# # remove components not needed for model.frame
66
72
m $ flow <- m $ dates <- m $ flow.units <- m $ conc.units <- NULL
67
73
m $ load.units <- m $ time.step <- m $ station <- NULL
@@ -246,6 +252,11 @@ loadReg <- function(formula, data, subset, na.action, flow, dates,
246
252
lfit $ xlevels <- xlevels
247
253
class(lfit ) <- " censReg"
248
254
# # Construct the evaluation data frame
255
+ # # Capture errors
256
+ if (lfit $ IERR > 0L ) {
257
+ lfit $ AIC <- lfit $ SPPC <- Inf
258
+ lfit $ LLR <- - Inf
259
+ }
249
260
MEC <- data.frame (model = model.no , AIC = lfit $ AIC , SPCC = lfit $ SPPC )
250
261
retval <- list (station = station , constituent = ynam ,
251
262
flow = flow , dates = dates , Qadj = Qadj ,
0 commit comments