Running examples in 'robcp-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: huber_cusum
> ### Title: Huberized CUSUM test
> ### Aliases: huber_cusum
> 
> ### ** Examples
> 
> set.seed(1895)
> 
> #time series with a structural break at t = 20
> Z <- c(rnorm(20, 0), rnorm(20, 2))
> huber_cusum(Z) 

	Huberized CUSUM test

data:  Z
S = 1.7674, p-value = 0.003871
alternative hypothesis: two-sided

> 
> # two time series with a structural break at t = 20
> timeSeries <- matrix(c(rnorm(20, 0), rnorm(20, 2), rnorm(20, 1), rnorm(20, 3), 
+                      ncol = 2))
>                      
> huber_cusum(timeSeries)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
robcp
 --- call from context --- 
psi(y, fun, k, constant)
 --- call from argument --- 
if (class(y) == "matrix") {
    m <- ncol(y)
    n <- nrow(y)
    med <- apply(y, 2, median)
    MAD <- apply(y, 2, function(x) mad(x, constant = constant))
} else {
    if (fun %in% 7:8) {
        stop("VCm and VCg are not available for a one-dimensional timeline")
    }
    n <- length(y)
    m <- 1
    med <- median(y)
    MAD <- mad(y, constant = constant)
}
 --- R stacktrace ---
where 1: psi(y, fun, k, constant)
where 2: teststat(x, fun, b_n, k, constant)
where 3: huber_cusum(timeSeries)

 --- value of length: 2 type: logical ---
[1]  TRUE FALSE
 --- function from context --- 
function (y, fun = "HLm", k, constant = 1.4826) 
{
    if (!(any(class(y) == "matrix") | any(class(y) == "numeric" | 
        any(class(y) == "integer")))) {
        stop("x must be numeric and either be a vector or a matrix!")
    }
    fun <- which(c("HLm", "HLg", "VLm", "VLg", "HCm", "HCg", 
        "VCm", "VCg") == fun)
    if (length(fun) == 0) 
        stop("Wrong argument to 'fun'")
    if (missing(k)) {
        if (fun == 2 || fun == 6) {
            k <- sqrt(qchisq(0.8, df = ifelse(class(y) == "matrix", 
                ncol(y), 1)))
        }
        else k <- 1.5
    }
    if (missing(constant)) 
        constant <- 1.4826
    if (class(y) == "matrix") {
        m <- ncol(y)
        n <- nrow(y)
        med <- apply(y, 2, median)
        MAD <- apply(y, 2, function(x) mad(x, constant = constant))
    }
    else {
        if (fun %in% 7:8) {
            stop("VCm and VCg are not available for a one-dimensional timeline")
        }
        n <- length(y)
        m <- 1
        med <- median(y)
        MAD <- mad(y, constant = constant)
    }
    erg <- .Call("psi", as.numeric(y), as.numeric(fun), as.numeric(n), 
        as.numeric(m), as.numeric(k), as.numeric(constant), as.numeric(med), 
        as.numeric(MAD))
    if (class(y) == "matrix") 
        erg <- matrix(erg, nrow = n)
    return(erg)
}
<bytecode: 0x1892820>
<environment: namespace:robcp>
 --- function search by body ---
Function psi in namespace robcp has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(y) == "matrix") { : the condition has length > 1
Calls: huber_cusum -> teststat -> psi
Execution halted