R/ranks.R

Defines functions ranks.VarImp ranks.default ranks

Documented in ranks ranks.default ranks.VarImp

## ranks Method
ranks <- function(x, note = TRUE, ...) UseMethod("ranks")

## ranks.default
ranks.default <- function(x, note = TRUE, ...){
   out <- length(x) - rank(x, ...) + 1L
   names(out) <- names(x)
   if(note) cat("Reversed ranking: 1 denotes the highest value. \n ")
   return(out)
}

## ranks for class VarImp
ranks.VarImp <- function(x, note = TRUE, ...){
   return(ranks(x$values, note = note, ...))
} 

Try the permimp package in your browser

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

permimp documentation built on Sept. 14, 2021, 1:07 a.m.