R/cost_matrix.R

Defines functions makeCostFile

makeCostFile <- function(cst) {
  classes <- colnames(cst)
  out <- ""
  for (i in 1:nrow(cst)) {
    for (j in 1:ncol(cst)) {
      if (i != j && cst[i, j] > 1) {
        out <- paste(out,
                     paste(classes[i], ", ", classes[j],
                           ": ", cst[i, j], "\n", sep = ""),
                     sep = "")
      }
    }
  }
  out
}

Try the C50 package in your browser

Any scripts or data that you put into this service are public.

C50 documentation built on Feb. 16, 2023, 5:08 p.m.