R/mostCommonObservation.R

Defines functions mostCommonObservation

Documented in mostCommonObservation

#' Uses the mode of each row of a data frame to return a generic observation
#' exemplary of the data set.
#'
#' @param x a data frame.
#' @return The most common row in a data frame. \code{y}.
#' @examples
#' mostCommonObservation(x)
#' @export
mostCommonObservation <- function(x){
  names <- colnames(x)
  lgth <- length(names)
  dummy <- names
  index <- 1
  while(index <= lgth)
  {
    dummy[index] <- colMode(x[,index])
    index <- index + 1
  }
  return(dummy)
}
Jacob909/prdctr documentation built on Dec. 18, 2021, 12:29 a.m.