Errors in running code in vignettes:
when running code in ‘libcoin.Rnw’
  ...

> isequal <- function(a, b) {
+     attributes(a) <- NULL
+     attributes(b) <- NULL
+     if (!isTRUE(all.equal(a, b))) {
+         print(a, digits  .... [TRUNCATED] 

> library("libcoin")

> set.seed(290875)

> x <- gl(5, 20)

> y <- round(runif(length(x)), 1)

> ls1 <- LinStatExpCov(X = model.matrix(~x - 1), Y = matrix(y, 
+     ncol = 1))

> ls1$LinearStatistic
[1]  8.8  9.5 10.3  9.8 10.5

> tapply(y, x, sum)
   1    2    3    4    5 
 8.8  9.5 10.3  9.8 10.5 

> ls2 <- LinStatExpCov(X = x, Y = matrix(y, ncol = 1))

> all.equal(ls1[-grep("Xfactor", names(ls1))], ls2[-grep("Xfactor", 
+     names(ls2))])
[1] TRUE

> X <- rbind(0, diag(nlevels(x)))

> ix <- unclass(x)

> ylev <- sort(unique(y))

> Y <- rbind(0, matrix(ylev, ncol = 1))

> iy <- .bincode(y, breaks = c(-Inf, ylev, Inf))

> ls3 <- LinStatExpCov(X = X, ix = ix, Y = Y, iy = iy)

> all.equal(ls1[-grep("Table", names(ls1))], ls3[-grep("Table", 
+     names(ls3))])
[1] TRUE

> ls3 <- LinStatExpCov(X = X, ix = factor(ix), Y = Y, 
+     iy = factor(iy))

> all.equal(ls1[-grep("Table", names(ls1))], ls3[-grep("Table", 
+     names(ls3))])
[1] TRUE

> ls4 <- LinStatExpCov(ix = ix, Y = Y, iy = iy)

> all.equal(ls3[-grep("Xfactor", names(ls3))], ls4[-grep("Xfactor", 
+     names(ls4))])
[1] TRUE

> ls3$Table
, , 1

     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]    0    0    0    0    0    0    0    0    0     0     0     0
[2,]    0    0    4    4    1    2    3    0    1     2     3     0
[3,]    0    2    2    1    2    2    5    0    1     1     3     1
[4,]    0    1    1    4    0    1    5    2    0     2     3     1
[5,]    0    0    2    2    4    2    2    1    3     2     1     1
[6,]    0    1    3    1    1    1    2    2    2     6     1     0


> xtabs(~ix + iy)
   iy
ix  1 2 3 4 5 6 7 8 9 10 11
  1 0 4 4 1 2 3 0 1 2  3  0
  2 2 2 1 2 2 5 0 1 1  3  1
  3 1 1 4 0 1 5 2 0 2  3  1
  4 0 2 2 4 2 2 1 3 2  1  1
  5 1 3 1 1 1 2 2 2 6  1  0

> ls1$Covariance
 [1]  1.3572364 -0.3393091 -0.3393091 -0.3393091 -0.3393091  1.3572364
 [7] -0.3393091 -0.3393091 -0.3393091  1.3572364 -0.3393091 -0.3393091
[13]  1.3572364 -0.3393091  1.3572364

> vcov(ls1)
           [,1]       [,2]       [,3]       [,4]       [,5]
[1,]  1.3572364 -0.3393091 -0.3393091 -0.3393091 -0.3393091
[2,] -0.3393091  1.3572364 -0.3393091 -0.3393091 -0.3393091
[3,] -0.3393091 -0.3393091  1.3572364 -0.3393091 -0.3393091
[4,] -0.3393091 -0.3393091 -0.3393091  1.3572364 -0.3393091
[5,] -0.3393091 -0.3393091 -0.3393091 -0.3393091  1.3572364

> doTest(ls1, teststat = "maximum", pvalue = FALSE)
$TestStatistic
[1] 0.8411982

$p.value
[1] NA


> doTest(ls1, teststat = "maximum")
$TestStatistic
[1] 0.8411982

$p.value
[1] 0.8852087


> doTest(ls1, teststat = "maximum", log = TRUE)
$TestStatistic
[1] 0.8411982

$p.value
[1] 0.108822


> doTest(ls1, teststat = "maximum", lower = TRUE)
$TestStatistic
[1] 0.8411982

$p.value
[1] 0.1150168


> doTest(ls1, teststat = "maximum", lower = TRUE, log = TRUE)
$TestStatistic
[1] 0.8411982

$p.value
[1] -2.164164


> doTest(ls1, teststat = "quadratic")
$TestStatistic
[1] 1.077484

$p.value
[1] 0.897828


> set.seed(29)

> ls1d <- LinStatExpCov(X = model.matrix(~x - 1), Y = matrix(y, 
+     ncol = 1), nresample = 10, standardise = TRUE)

> set.seed(29)

> ls1s <- LinStatExpCov(X = as.double(1:5)[x], Y = matrix(y, 
+     ncol = 1), nresample = 10, standardise = TRUE)

> ls1c <- lmult(c(1:5), ls1d)

> stopifnot(isequal(ls1c, ls1s))

> set.seed(29)

> ls1d <- LinStatExpCov(X = model.matrix(~x - 1), Y = matrix(c(y, 
+     y), ncol = 2), nresample = 10, standardise = TRUE)

> set.seed(29)

> ls1s <- LinStatExpCov(X = as.double(1:5)[x], Y = matrix(c(y, 
+     y), ncol = 2), nresample = 10, standardise = TRUE)

> ls1c <- lmult(c(1:5), ls1d)

> stopifnot(isequal(ls1c, ls1s))

> t1 <- ctabs(ix = ix, iy = iy)

> t2 <- xtabs(~ix + iy)

> max(abs(t1[-1, -1] - t2))
[1] 0

> N <- 20

> P <- 3

> Lx <- 10

> Ly <- 5

> Q <- 4

> B <- 2

> iX2d <- rbind(0, matrix(runif(Lx * P), nrow = Lx))

> ix <- sample(1:Lx, size = N, replace = TRUE)

> levels(ix) <- 1:Lx

> ixf <- factor(ix, levels = 1:Lx, labels = 1:Lx)

> x <- iX2d[ix + 1, ]

> Xfactor <- diag(Lx)[ix, ]

> iY2d <- rbind(0, matrix(runif(Ly * Q), nrow = Ly))

> iy <- sample(1:Ly, size = N, replace = TRUE)

> levels(iy) <- 1:Ly

> iyf <- factor(iy, levels = 1:Ly, labels = 1:Ly)

> y <- iY2d[iy + 1, ]

> weights <- sample(0:5, size = N, replace = TRUE)

> block <- sample(gl(B, ceiling(N/B))[1:N])

> subset <- sort(sample(1:N, floor(N * 1.5), replace = TRUE))

> subsety <- sample(1:N, floor(N * 1.5), replace = TRUE)

> r1 <- rep(1:ncol(x), ncol(y))

> r1Xfactor <- rep(1:ncol(Xfactor), ncol(y))

> r2 <- rep(1:ncol(y), each = ncol(x))

> r2Xfactor <- rep(1:ncol(y), each = ncol(Xfactor))

> LECV <- function(X, Y, weights = integer(0), subset = integer(0), 
+     block = integer(0)) {
+     if (length(weights) == 0) 
+         weights <- .... [TRUNCATED] 

> cmpr <- function(ret1, ret2) {
+     if (inherits(ret1, "LinStatExpCov")) {
+         if (!ret1$varonly) 
+             ret1$Covariance <- vcov(ret1 .... [TRUNCATED] 

> LECVxyws <- LinStatExpCov(x, y, weights = weights, 
+     subset = subset)

> LEVxyws <- LinStatExpCov(x, y, weights = weights, 
+     subset = subset, varonly = TRUE)

> testit <- function(...) {
+     a <- LinStatExpCov(x, y, ...)
+     b <- LECV(x, y, ...)
+     d <- LinStatExpCov(X = iX2d, ix = ix, Y = iY2d, iy =  .... [TRUNCATED] 

> stopifnot(testit() && testit(weights = weights) && 
+     testit(subset = subset) && testit(weights = weights, subset = subset) && 
+     testit(blo .... [TRUNCATED] 

> testit <- function(...) {
+     a <- LinStatExpCov(X = ix, y, ...)
+     b <- LECV(Xfactor, y, ...)
+     d <- LinStatExpCov(X = integer(0), ix = ix .... [TRUNCATED] 

> stopifnot(testit() && testit(weights = weights) && 
+     testit(subset = subset) && testit(weights = weights, subset = subset) && 
+     testit(blo .... [TRUNCATED] 

> LinStatExpCov(X = iX2d, ix = ix, Y = iY2d, iy = iy, 
+     weights = weights, subset = subset, nresample = 10)$PermutedLinearStatistic

 *** caught segfault ***
address 0x55b060314e8c, cause 'memory not mapped'

Traceback:
 1: .LinStatExpCov2d(X = X, Y = Y, ix = ix, iy = iy, weights = weights,     subset = subset, block = block, varonly = varonly, checkNAs = checkNAs,     nresample = nresample, standardise = standardise, tol = tol)
 2: LinStatExpCov(X = iX2d, ix = ix, Y = iY2d, iy = iy, weights = weights,     subset = subset, nresample = 10)
 3: eval(ei, envir)
 4: eval(ei, envir)
 5: withVisible(eval(ei, envir))
 6: source(output, echo = TRUE)
 7: doTryCatch(return(expr), name, parentenv, handler)
 8: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 9: tryCatchList(expr, classes, parentenv, handlers)
10: tryCatch({    source(output, echo = TRUE)}, error = function(e) {    cat("\n  When sourcing ", sQuote(output), ":\n", sep = "")    stop(conditionMessage(e), call. = FALSE, domain = NA)})
11: tools:::.run_one_vignette("libcoin.Rnw", "/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/libcoin/vignettes",     encoding = "UTF-8", pkgdir = "/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/libcoin")
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault

... incomplete output.  Crash?

  ‘libcoin.Rnw’ using ‘UTF-8’... failed to complete the test