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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: blockNorm
> ### Title: Sum of squares block weighting
> ### Aliases: blockNorm
> 
> ### ** Examples
> 
> X <- matrix(rnorm(100),ncol=10)
> # Block normalize to sum of square = 1
> res <- blockNorm(X,1)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
prospectr
 --- call from context --- 
blockNorm(X, 1)
 --- call from argument --- 
if (!class(X) %in% c("matrix", "data.frame")) stop("X should be a matrix or data.frame")
 --- R stacktrace ---
where 1: blockNorm(X, 1)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (X, targetnorm = 1) 
{
    if (!class(X) %in% c("matrix", "data.frame")) 
        stop("X should be a matrix or data.frame")
    if (is.data.frame(X)) 
        X <- as.matrix(X)
    if (targetnorm == 1) {
        f <- sum(X^2, na.rm = T)^0.5
    }
    else {
        fmax <- sum(X^2, na.rm = T)
        fmaxn <- sum((X/fmax)^2, na.rm = T)
        if (fmaxn > targetnorm) {
            fmin <- fmax
            fminn <- fmaxn
            while (fminn > targetnorm) {
                fmin <- fmin * 10
                fminn <- sum((X/fmin)^2, na.rm = T)
            }
        }
        else {
            fmin <- fmax
            fminn <- fmaxn
            while (fmaxn < targetnorm) {
                fmax <- fmax/10
                fmaxn <- sum((X/fmax)^2, na.rm = T)
            }
        }
        n <- fmaxn
        while ((targetnorm - n)^2 > 1e-12) {
            f <- (fmin + fmax)/2
            n <- sum((X/f)^2, na.rm = T)
            if (n > targetnorm) 
                fmax <- f
            else fmin <- f
        }
    }
    Xn <- X/f
    list(Xscaled = Xn, f = f)
}
<bytecode: 0x55697cc13570>
<environment: namespace:prospectr>
 --- function search by body ---
Function blockNorm in namespace prospectr has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (!class(X) %in% c("matrix", "data.frame")) stop("X should be a matrix or data.frame") : 
  the condition has length > 1
Calls: blockNorm
Execution halted