R/mnrva_check_unique.R

Defines functions mnrva_check_unique

Documented in mnrva_check_unique

#' Check rows in matrix are all unique
#'
#' @param x matrix
#'
#' @return logical TRUE (the rows are all unique), or FALSE (the rows are not all unique)
#' @export
#'
#' @examples
#' 
#' mat <- mnrva_item_matrix(n_items = 5, vec_length = 10)
#' mnrva_check_unique(mat)
#' 
mnrva_check_unique <- function(x){
  correlations <- cor(t(x))
  eval_sum <- sum(correlations[lower.tri(correlations)] == 1)
  if(eval_sum == 0) return(TRUE)
  if(eval_sum != 0) return(FALSE)
}
CrumpLab/minerva documentation built on Oct. 30, 2019, 5:50 a.m.