R/dashmatrix.R

Defines functions dashmatrix

Documented in dashmatrix

#' Dash Matrix
#' @description Function to obtain the matrix of number of 1-1s, 1-2s, and so on.
#' @param data dataset with competitors as rows and judges as columns
#' @return A matrix:
#' \item{dashmatrix}{matrix of number of placements}
#' @examples
#' dashmatrix(testdata)
#' @export

dashmatrix <- function(data) {
  dashmat <- matrix(NA, nrow(data), nrow(data))
  for (i in 1:nrow(data)) {
    dashmat[i,] <- cumsum(table(factor(data[i,], levels = 1:nrow(data))))
  }
  dashmat
}

Try the RPscoring package in your browser

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

RPscoring documentation built on July 1, 2020, 7:09 p.m.