R/get_realloc_nms.R

Defines functions get_realloc_nms

get_realloc_nms <- function(comps, comparisons, poss_comps) {

  n_p <- nrow(poss_comps)
  realloc_nms <- matrix("", nrow = n_p, ncol = 2) # make labels for reallocations
  
  if (comparisons == "one-v-all") {
    
    for (i in 1:n_p)
      realloc_nms[i, ] <- c(comps[poss_comps[i,] == 1], "equal-realloc")
    
  } else if (comparisons == "prop-realloc") {
    
    for (i in 1:n_p)
      realloc_nms[i, ] <- c(comps[poss_comps[i,] == 1], "proportional-realloc")
    
  } else { # comparisons = "one-v-one", DEFAULT
    
    for (i in 1:n_p)
      realloc_nms[i, ] <- c(comps[poss_comps[i,] == 1] , comps[poss_comps[i,] == -1])
    
  }

  return(realloc_nms)

}
tystan/deltacomp documentation built on Oct. 26, 2022, 7:24 a.m.