diff --git a/R/mfairInitialization.R b/R/mfairInitialization.R index 8ade85c..49bb65b 100644 --- a/R/mfairInitialization.R +++ b/R/mfairInitialization.R @@ -34,11 +34,10 @@ createMFAIR <- function(Y, X, Y_sparse <- TRUE message("The main data matrix Y has been stored in the sparse mode!") } else if (Y_sparse == TRUE) { # Y is not in sparse mode, but we want it to be - obs_tf <- !is.na(Y) # Indicates whether observed or missing - obs_indices <- which(obs_tf, arr.ind = TRUE) # Indices of observed entries + obs_indices <- which(!is.na(Y), arr.ind = TRUE) # Indices of observed entries Y <- Matrix::sparseMatrix( i = obs_indices[, "row"], j = obs_indices[, "col"], - x = Y[obs_tf], + x = Y[obs_indices], dims = c(N, M), symmetric = FALSE, triangular = FALSE, index1 = TRUE diff --git a/data-raw/ml10m.R b/data-raw/ml10m.R index 4187a24..8111350 100644 --- a/data-raw/ml10m.R +++ b/data-raw/ml10m.R @@ -69,8 +69,7 @@ movie_genre_matrix <- t(sapply( movies[, 3], FUN = function(x) { as.integer(all_genres %in% - unlist(strsplit(x, split = "|", fixed = TRUE)) - ) + unlist(strsplit(x, split = "|", fixed = TRUE))) }, USE.NAMES = FALSE ))