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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: CMF-package
> ### Title: Collective Matrix Factorization (CMF)
> ### Aliases: CMF-package
> ### Keywords: package
> 
> ### ** Examples
> 
>  require("CMF")
>  # Create data for a circular setup with three matrices and three
>  # object sets of varying sizes.
>  X <- list()
>  D <- c(10,20,30)
>  inds <- matrix(0,nrow=3,ncol=2)
>  
>  # Matrix 1 is between sets 1 and 2 and has continuous data
>  inds[1,] <- c(1,2)
>  X[[1]] <- matrix(rnorm(D[inds[1,1]]*D[inds[1,2]],0,1),nrow=D[inds[1,1]])
> 
>  # Matrix 2 is between sets 1 and 3 and has binary data
>  inds[2,] <- c(1,3)
>  X[[2]] <- matrix(round(runif(D[inds[2,1]]*D[inds[2,2]],0,1)),nrow=D[inds[2,1]])
> 
>  # Matrix 3 is between sets 2 and 3 and has count data
>  inds[3,] <- c(2,3)
>  X[[3]] <- matrix(round(runif(D[inds[3,1]]*D[inds[3,2]],0,6)),nrow=D[inds[3,1]])
> 
>  # Convert the data into the right format
>  triplets <- list()
>  for(m in 1:3) triplets[[m]] <- matrix_to_triplets(X[[m]])
> 
>  # Missing entries correspond to missing rows in the triple representation
>  # so they can be removed from training data by simply taking a subset
>  # of the rows.
>  train <- list()
>  test <- list()
>  keepForTraining <- c(100,200,300)
>  for(m in 1:3) {
+    subset <- sample(nrow(triplets[[m]]))[1:keepForTraining[m]]
+    train[[m]] <- triplets[[m]][subset,]
+    test[[m]] <- triplets[[m]][setdiff(1:nrow(triplets[[m]]),subset),]
+  }
> 
>  # Learn the model with the correct likelihoods
>  K <- 4
>  likelihood <- c("gaussian","bernoulli","poisson")
>  opts <- getCMFopts()
>  opts$iter.max <- 10 # Less iterations for faster computation
>  model <- CMF(train,inds,K,likelihood,D,test=test,opts=opts)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
CMF
 --- call from context --- 
p_check_sparsity(X[[i]], D[inds[i, 1]], D[inds[i, 2]])
 --- call from argument --- 
if (class(mat) == "matrix") {
    if (ncol(mat) != 3 | min(mat[, 1:2]) < 1 | max(mat[, 1]) > 
        max_row | max(mat[, 2]) > max_col) {
        print("Matrix not in coordinate/triplet format")
        return(FALSE)
    }
    else {
        return(TRUE)
    }
}
 --- R stacktrace ---
where 1: p_check_sparsity(X[[i]], D[inds[i, 1]], D[inds[i, 2]])
where 2: CMF(train, inds, K, likelihood, D, test = test, opts = opts)

 --- value of length: 2 type: logical ---
[1]  TRUE FALSE
 --- function from context --- 
function (mat, max_row, max_col) 
{
    if (class(mat) == "matrix") {
        if (ncol(mat) != 3 | min(mat[, 1:2]) < 1 | max(mat[, 
            1]) > max_row | max(mat[, 2]) > max_col) {
            print("Matrix not in coordinate/triplet format")
            return(FALSE)
        }
        else {
            return(TRUE)
        }
    }
    print("Input not of class 'matrix'")
    return(FALSE)
}
<bytecode: 0x55e4532f76d8>
<environment: namespace:CMF>
 --- function search by body ---
Function p_check_sparsity in namespace CMF has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(mat) == "matrix") { : the condition has length > 1
Calls: CMF -> p_check_sparsity
Execution halted