Running examples in ‘tvReg-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: forecast
> ### Title: Forecast Methods for Objects in tvReg.
> ### Aliases: forecast forecast.tvlm forecast.tvar forecast.tvvar
> ###   forecast.tvsure
> 
> ### ** Examples
> 
> data("RV")
> RV2 <- head(RV, 2001)
> tvHAR <- tvLM (RV ~ RV_lag + RV_week + RV_month, data = RV2, bw = 20)
> newx <- cbind(RV$RV_lag[2002:2004], RV$RV_week[2002:2004],
+               RV$RV_month[2002:2004])
> forecast(tvHAR, newx, n.ahead = 3)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
tvReg
 --- call from context --- 
forecast.tvlm(tvHAR, newx, n.ahead = 3)
 --- call from argument --- 
if (class(beta) == "try-error") {
    object$bw <- bw(object)
    beta <- tvOLS(object)$tvcoef
}
 --- R stacktrace ---
where 1: forecast.tvlm(tvHAR, newx, n.ahead = 3)
where 2: forecast(tvHAR, newx, n.ahead = 3)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (object, newx, n.ahead = 1, winsize = 0, ...) 
{
    if (!inherits(object, c("tvlm"))) 
        stop("\nParameter 'object' should be entered and it should have class 'tvlm' or 'tvar'.\n")
    if (!is.null(object$z)) 
        stop("\nYour model coefficients are functions of a random variable 'z', use function \n         'predict' with parameter 'newz'.\n")
    if (!inherits(newx, c("data.frame", "matrix", "numeric", 
        "vector"))) 
        stop("\nParameter 'newx' should be entered and it should be a numeric vector if there is only\n         one row or a 'matrix' or a 'data.frame' for more than one row.\n")
    if (n.ahead == 1) 
        newx <- matrix(newx, ncol = length(newx))
    if (NROW(newx) != n.ahead) 
        stop("\nDimensions of 'newx' are not compatible with 'n.ahead'.\n")
    n.col <- NCOL(newx)
    is.intercept <- ("(Intercept)" %in% colnames(object$x))
    if (is.intercept & n.col == (NCOL(object$x) - 1)) 
        newx <- cbind(rep(1, n.ahead), newx)
    obs <- object$obs
    is.rw <- !(winsize == 0)
    if (winsize > obs | winsize < 0) 
        winsize <- obs - 1
    prediction <- numeric(n.ahead)
    tobs <- obs + n.ahead
    grid <- (1:tobs)/tobs
    X <- object$x
    Y <- object$y
    for (t in 1:n.ahead) {
        i <- ifelse(is.rw, obs - winsize, 1)
        object$x <- X[i:(obs + t - 1), ]
        object$y <- Y[i:(obs + t - 1)]
        object$z <- grid[i:(obs + t - 1)]
        object$ez <- grid[obs + t]
        beta <- try(tvOLS(object)$tvcoef)
        if (class(beta) == "try-error") {
            object$bw <- bw(object)
            beta <- tvOLS(object)$tvcoef
        }
        prediction[t] <- beta %*% newx[t, ]
        X <- rbind(X, newx[t, ])
        Y <- c(Y, prediction[t])
    }
    return(prediction)
}
<bytecode: 0x5625283e0260>
<environment: namespace:tvReg>
 --- function search by body ---
Function forecast.tvlm in namespace tvReg has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(beta) == "try-error") { : the condition has length > 1
Calls: forecast -> forecast.tvlm
Execution halted