R/compare_criteria.R

Defines functions compare_criteria

Documented in compare_criteria

#' Relation results
#'
#' Returns relation results that exceed threshold value of direct relationship decision matrix
#'
#' @param x a matrix containing the values of direct relationship decision matrix.
#'
#' @return This function returns a \code{num} matrix.
#'
#' @author Muhlis Ozdemir <muhlisoz@gmail.com>
#'
#' @export
#'
#' @seealso \link[base]{apply} function.
#'
#' @examples
#' compare_criteria(dematel::hospitaldata)
#' compare_criteria(dematel::nurseselection)
#' compare_criteria(dematel::medicaldevice)
compare_criteria <- function(x) {

  x <- check_data(x)

  get_total_relationship_matrix <- total_relationship_matrix(x)
  get_threshold_value <- threshold_value(x)

  compare <- function(x, get_threshold_value){
    names(which(x > get_threshold_value))
    x[which(x > get_threshold_value)]
  }

  return(apply(get_total_relationship_matrix, 1, compare, get_threshold_value))

}
muhlisoz/dematel documentation built on Feb. 16, 2021, 12:06 a.m.