File: print.varImp.train.R

package info (click to toggle)
r-cran-caret 6.0-93%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,028 kB
  • sloc: ansic: 210; sh: 10; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#' @method print varImp.train
#' @export
"print.varImp.train" <-
function(x, top = min(20, dim(x$importance)[1]), digits = max(3, getOption("digits") - 3), ...)
{
   cat(x$model, "variable importance\n\n")

   printObj <- sortImp(x, top)

   if(dim(x$importance)[2] > 2)
     cat("  variables are sorted by maximum importance across the classes\n")
     
   if(top < dim(x$importance)[1]) 
      cat("  only ", top, " most important variables shown (out of ", dim(x$importance)[1], ")\n\n", sep = "")
    
   if(dim(printObj)[2] == 2)
   {
      printObj <- printObj[,1,drop = FALSE]
      names(printObj) <- "Importance"
   }
   print(printObj, digits = digits, ...)
   invisible(x)
}