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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: fit_models
> ### Title: Matrix Factorization Models
> ### Aliases: fit_models CMF CMF_implicit MostPopular ContentBased
> ###   OMF_explicit OMF_implicit
> 
> ### ** Examples
> 
> ### See the package vignette for an extended version of this example
> 
> library(cmfrec)
> if (require("recommenderlab") && require("MatrixExtra")) {
+     ### Load the ML100K dataset (movie ratings)
+     ### (users are rows, items are columns)
+     data("MovieLense")
+     X <- as.coo.matrix(MovieLense@data)
+ 
+     ### Will add basic side information about the users
+     U <- MovieLenseUser
+     U$id      <- NULL
+     U$zipcode <- NULL
+     U <- model.matrix(~.-1, data=U)
+ 
+     ### Will additionally use the item genres as side info
+     I <- MovieLenseMeta
+     I$title <- NULL
+     I$year  <- NULL
+     I$url   <- NULL
+     I <- as.coo.matrix(I)
+ 
+     ### Fit a factorization model
+     ### (it's recommended to change the hyperparameters
+     ###  and use multiple threads)
+     model <- CMF(X=X, U=U, I=I, k=10L, niter=5L,
+                  NA_as_zero_item=TRUE,
+                  verbose=FALSE, nthreads=1L)
+ 
+     ### Predict rating for entries X[1,3], X[2,5], X[10,9]
+     ### (first ID is the user, second is the movie)
+     predict(model, user=c(1,2,10), item=c(3,5,9))
+ 
+     ### Recommend top-5 for user ID = 10
+     ### (Note that 'MatrixExtra' makes this return a 'sparseVector')
+     seen_by_user <- MovieLense@data[10, , drop=TRUE]@i
+     rec <- topN(model, user=10, n=5, exclude=seen_by_user)
+     rec
+ 
+     ### Print them in a more understandable format
+     movie_names <- colnames(X)
+     n_ratings <- colSums(as.csc.matrix(X, binary=TRUE))
+     avg_ratings <- colSums(as.csc.matrix(X)) / n_ratings
+     print_recommended <- function(rec, txt) {
+         cat(txt, ":\n",
+             paste(paste(1:length(rec), ". ", sep=""),
+                   movie_names[rec],
+                   " - Avg rating:", round(avg_ratings[rec], 2),
+                   ", #ratings: ", n_ratings[rec],
+                   collapse="\n", sep=""),
+             "\n", sep="")
+     }
+     print_recommended(rec, "Recommended for user_id=10")
+ 
+ 
+     ### Recommend assuming it is a new user,
+     ### based on its data (ratings + side info)
+     x_user <- X[10, , drop=TRUE] ## <- this is a 'sparseVector'
+     u_user <- U[10, ]
+     rec_new <- topN_new(model, n=5, X=x_user, U=u_user, exclude=seen_by_user)
+     cat("lists are identical: ", identical(rec_new, rec), "\n")
+ 
+     ### Recommend based on side information alone
+     ### (a.k.a. cold-start recommendation)
+     rec_cold <- topN_new(model, n=5, U=u_user)
+     print_recommended(rec_cold, "Recommended based on side info")
+ 
+     ### Obtain factors for the user
+     factors_user <- model$matrices$A[, 10, drop=TRUE]
+ 
+     ### Re-calculate them based on the data
+     factors_new <- factors_single(model, X=x_user, U=u_user)
+ 
+     ### Should be very close, but due to numerical precision,
+     ### might not be exactly equal (see section 'Details')
+     cat("diff: ", factors_user - factors_new, "\n")
+ 
+     ### Can also calculate them in batch
+     ### (slicing is provided by package "MatrixExtra")
+     Xslice <- as.csr.matrix(X)[1:10, , drop=FALSE]
+     Uslice <- U[1:10, , drop=FALSE]
+     factors_multiple <- factors(model, X=Xslice, U=Uslice)
+     cat("diff: ", factors_multiple[10, , drop=TRUE] - factors_new, "\n")
+ 
+     ### Can make cold-start predictions, e.g.
+     ### predict how would users [1,2,3] rate a new item,
+     ### given it's side information (here it's item ID = 5)
+     predict_new_items(model, user=c(1,2,3), item=c(1,1,1), I=I[5, ])
+ }
Loading required package: recommenderlab
Loading required package: Matrix
Loading required package: arules

Attaching package: ‘arules’

The following objects are masked from ‘package:base’:

    abbreviate, write

Loading required package: proxy

Attaching package: ‘proxy’

The following object is masked from ‘package:Matrix’:

    as.matrix

The following objects are masked from ‘package:stats’:

    as.dist, dist

The following object is masked from ‘package:base’:

    as.matrix

Loading required package: MatrixExtra
'MatrixExtra' modifies important behaviors from 'Matrix'. See ?MatrixExtra-options.
Recommended for user_id=10:
1. Schindler's List (1993) - Avg rating:4.47, #ratings: 298
2. To Kill a Mockingbird (1962) - Avg rating:4.29, #ratings: 219
3. E.T. the Extra-Terrestrial (1982) - Avg rating:3.83, #ratings: 300
4. As Good As It Gets (1997) - Avg rating:4.2, #ratings: 112
5. High Noon (1952) - Avg rating:4.1, #ratings: 88
Error in process.data.factors.single("CMF", model, X = X, X_col = X_col,  : 
  Model was not fit to 'U' data.
Calls: topN_new ... topN_new.CMF -> factors_single.CMF -> process.data.factors.single
Execution halted