Running ‘tests.R’ [2s/3s]
Running the tests in ‘tests/tests.R’ failed.
Complete output:
  > #devtools::install_github("psolymos/detect")
  > library(detect)
  Loading required package: Formula
  Loading required package: stats4
  Loading required package: pbapply
  detect 0.4-4 	 2020-08-12
  > 
  > ## --- run examples with \dontrun sections ---
  > 
  > help_pages <- c(#"bootstrap",
  +     "cmulti", "convertEDR", "databu", "datocc",
  +     "hbootindex", "oven", "svabu", "svocc")
  > 
  > for (i in help_pages) {
  +     cat("\n\n---------- detect example:", i, "----------\n\n")
  +     eval(parse(text=paste0("example(", i,
  +         ", package = 'detect', run.dontrun = TRUE)")))
  + }
  
  
  ---------- detect example: cmulti ----------
  
  
  cmulti> simfun1 <- function(n = 10, phi = 0.1, c=1, tau=0.8, type="rem") {
  cmulti+     if (type=="dis") {
  cmulti+         Dparts <- matrix(c(0.5, 1, NA,
  cmulti+                       0.5, 1, Inf,
  cmulti+                       1, Inf, NA), 3, 3, byrow=TRUE)
  cmulti+         D <- Dparts[sample.int(3, n, replace=TRUE),]
  cmulti+         CP <- 1-exp(-(D/tau)^2)
  cmulti+     } else {
  cmulti+         Dparts <- matrix(c(5, 10, NA,
  cmulti+                       3, 5, 10,
  cmulti+                       3, 5, NA), 3, 3, byrow=TRUE)
  cmulti+         D <- Dparts[sample.int(3, n, replace=TRUE),]
  cmulti+         CP <- 1-c*exp(-D*phi)
  cmulti+     }
  cmulti+     k <- ncol(D)
  cmulti+     P <- CP - cbind(0, CP[, -k, drop=FALSE])
  cmulti+     Psum <- rowSums(P, na.rm=TRUE)
  cmulti+     PPsum <- P / Psum
  cmulti+     Pok <- !is.na(PPsum)
  cmulti+     N <- rpois(n, 10)
  cmulti+     Y <- matrix(NA, ncol(PPsum), nrow(PPsum))
  cmulti+     Ypre <- sapply(1:n, function(i) rmultinom(1, N, PPsum[i,Pok[i,]]))
  cmulti+     Y[t(Pok)] <- unlist(Ypre)
  cmulti+     Y <- t(Y)
  cmulti+     list(Y=Y, D=D)
  cmulti+ }
  
  cmulti> n <- 200
  
  cmulti> x <- rnorm(n)
  
  cmulti> X <- cbind(1, x)
  
  cmulti> ## removal, constant
  cmulti> vv <- simfun1(n=n, phi=exp(-1.5))
  
  cmulti> m1 <- cmulti(vv$Y | vv$D ~ 1, type="rem")
  Error in aggregate.data.frame(as.data.frame(x), ...) : 
    no rows to aggregate
  Calls: eval ... aggregate -> aggregate.default -> aggregate.data.frame
  In addition: Warning messages:
  1: In checkDesign(Y, D, X, Z, Q, count) :
    dependent variable does not contain any count > 1
  2: In max(D, na.rm = TRUE) :
    no non-missing arguments to max; returning -Inf
  3: In log(max(D, na.rm = TRUE)) : NaNs produced
  Execution halted