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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: vMask-package
> ### Title: Detect Small Changes in Process Mean using CUSUM Control Chart
> ###   by v-Mask
> ### Aliases: vMask-package vMask
> 
> ### ** Examples
> 
> 
> 
> ### Example 1:  V-Mask CUSUM chart with vectored data based on the real data from:
> #   https://www.itl.nist.gov/div898/handbook/pmc/section3/pmc323.htm
> 
> # In this applied example We are going to quickly detect a shift in mean as large as one 
> # sigma by CUSUM chart.
> 
> Data = c( 324.925, 324.675, 324.725, 324.350, 325.350, 325.225, 
+           324.125, 324.525, 325.225, 324.600, 324.625, 325.150, 
+           328.325, 327.250, 327.825, 328.500, 326.675, 327.775, 
+           326.875, 328.350 )
> n = 4
> mean(Data)
[1] 325.9538
> sd(Data)
[1] 1.548307
> sd(Data)/sqrt(n)
[1] 0.7741536
> 
> vMask.method3( data=Data, mu0=325, k=1, alpha=.0027, beta=.01, s="PressEnter" )
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
Press [enter] in 'R Console' to continue
$d
[1] 11.80891

$theta
[1] 37.74537

$h
[1] 9.141907

$c
 [1] -0.075 -0.400 -0.675 -1.325 -0.975 -0.750 -1.625 -2.100 -1.875 -2.275
[11] -2.650 -2.500  0.825  3.075  5.900  9.400 11.075 13.850 15.725 19.075

$OutControl
[1] 17 18 19 20

$InControl
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16

> 
> 
> 
> ### Example 2:  V-Mask CUSUM chart based on a data matrix.
> # A wood products company manufactures charcoal briquettes for barbecues. It packages these 
> # briquettes in bags of various sizes, the largest of which is supposed to contain 40 lbs.
> # The weights of bags from 16 different samples, each of size n=4 are given in below. 
> 
> n = 4
> m = 16
> mu0 = 40
> sigma = .5
> 
> Data = c( 40.77, 39.95, 40.86, 39.21,  
+           38.94, 39.70, 40.37, 39.88,  
+           40.43, 40.27, 40.91, 40.05,  
+           39.55, 40.10, 39.39, 40.89,  
+           41.01, 39.07, 39.85, 40.32,  
+           39.06, 39.90, 39.84, 40.22,  
+           39.63, 39.42, 40.04, 39.50,  
+           41.05, 40.74, 40.43, 39.40,  
+           40.28, 40.89, 39.61, 40.48,  
+           39.28, 40.49, 38.88, 40.72,  
+           40.57, 40.04, 40.85, 40.51,  
+           39.90, 40.67, 40.51, 40.53,  
+           40.70, 40.54, 40.73, 40.45,  
+           39.58, 40.90, 39.62, 39.83,  
+           40.16, 40.69, 40.37, 39.69,  
+           40.46, 40.21, 40.09, 40.58 )  
> 
> M = matrix(Data, ncol=n, byrow=TRUE)
> M
       [,1]  [,2]  [,3]  [,4]
 [1,] 40.77 39.95 40.86 39.21
 [2,] 38.94 39.70 40.37 39.88
 [3,] 40.43 40.27 40.91 40.05
 [4,] 39.55 40.10 39.39 40.89
 [5,] 41.01 39.07 39.85 40.32
 [6,] 39.06 39.90 39.84 40.22
 [7,] 39.63 39.42 40.04 39.50
 [8,] 41.05 40.74 40.43 39.40
 [9,] 40.28 40.89 39.61 40.48
[10,] 39.28 40.49 38.88 40.72
[11,] 40.57 40.04 40.85 40.51
[12,] 39.90 40.67 40.51 40.53
[13,] 40.70 40.54 40.73 40.45
[14,] 39.58 40.90 39.62 39.83
[15,] 40.16 40.69 40.37 39.69
[16,] 40.46 40.21 40.09 40.58
> 
> # X.bar Control Chart: 
> ( LCL = mu0 - 3*sigma/sqrt(n) )
[1] 39.25
> ( UCL = mu0 + 3*sigma/sqrt(n) )
[1] 40.75
> plot(1:16,rowMeans(M), col=3, pch=16, ylim=c(LCL-.2,UCL+.2))
> abline(h=c(mu0, LCL, UCL), col=2, lty=c(3,1,1))
> 
> # Three different strategies for putting v-mask on CUSUM Control Chart:
> cumsum(rowMeans(M)-mu0)
 [1]  0.1975 -0.0800  0.3350  0.3175  0.3800  0.1350 -0.2175  0.1875  0.5025
[10]  0.3450  0.8375  1.2400  1.8450  1.8275  2.0550  2.3900
> 
> vMask.method2( data=M, mu0=40, d=5.6, h=1, s=0 )
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
vMask
 --- call from context --- 
vMask.method1(data, mu0, d, theta, sleep)
 --- call from argument --- 
if (class(data) == "matrix") {
    m = dim(data)[1]
    n = dim(data)[2]
    RowMeans <- rowMeans(data)
}
 --- R stacktrace ---
where 1: vMask.method1(data, mu0, d, theta, sleep)
where 2: vMask.method2(data = M, mu0 = 40, d = 5.6, h = 1, s = 0)

 --- value of length: 2 type: logical ---
[1]  TRUE FALSE
 --- function from context --- 
function (data, mu0 = mean(data), d, theta = 14, sleep = 1) 
{
    if (class(data) == "matrix") {
        m = dim(data)[1]
        n = dim(data)[2]
        RowMeans <- rowMeans(data)
    }
    if (class(data) == "numeric" | class(data) == "integer") {
        m = length(data)
        n = 1
        RowMeans <- data
    }
    theta <- deg2rad(theta)
    h = d * tan(theta)
    c = cumsum(RowMeans - mu0)
    x.win = c(0, m + d + 5)
    y.win = c(min(c) - h * (m - 1 + d)/d, max(c) + h * (m - 1 + 
        d)/d)
    BackColor = rep(1, m)
    for (i in 1:m) {
        plot(x.win, y.win, type = "n", xlab = "i", ylab = expression(c[i]), 
            main = list(paste("CUSUM control chart and V-Mask on point (", 
                i, ", c", i, ")")))
        lines(1:m, c, type = "b", col = 1, cex = 1.3, pch = 21, 
            bg = BackColor)
        points(i, c[i], type = "p", cex = 2, col = 1, pch = 21, 
            bg = 7)
        x.Mask <- c(i + d, 1, i + d + 4, i + d + 4, 1)
        y.Mask <- c(c[i], c[i] + h * (i - 1 + d)/d, c[i] + h * 
            (i - 1 + d)/d, c[i] - h * (i - 1 + d)/d, c[i] - h * 
            (i - 1 + d)/d)
        polygon(x.Mask, y.Mask, border = 2, col = "coral1", lwd = 1, 
            density = c(10, 20), angle = c(-45, 45))
        lines(c(i, i + d), c(c[i], c[i]), col = "gray60", lty = 2)
        lines(c(i, i), c(c[i] + h, c[i] - h), col = "gray60", 
            lty = 2)
        for (j in 1:i) {
            LCL <- c[i] - h * (i - j + d)/d
            UCL <- c[i] + h * (i - j + d)/d
            if (!(LCL <= c[j] & c[j] <= UCL)) {
                for (jj in 1:i) {
                  LCL <- c[i] - h * (i - jj + d)/d
                  UCL <- c[i] + h * (i - jj + d)/d
                  if (!(LCL <= c[jj] & c[jj] <= UCL)) 
                    points(jj, c[jj], type = "p", cex = 1.6, 
                      col = 1, pch = 21, bg = "turquoise1")
                }
                BackColor[i] = 2
                break
            }
            else {
                BackColor[i] = "green3"
            }
        }
        if (sleep == "PressEnter") {
            cat("Press [enter] in 'R Console' to continue")
            line <- readline()
        }
        else {
            Sys.sleep(sleep)
        }
    }
    return(list(h = h, c = c, OutControl = which(BackColor == 
        2), InControl = which(BackColor == "green3")))
}
<bytecode: 0x1868a80>
<environment: namespace:vMask>
 --- function search by body ---
Function vMask.method1 in namespace vMask has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(data) == "matrix") { : the condition has length > 1
Calls: vMask.method2 -> vMask.method1
Execution halted