R/print.IPA.R

Defines functions print.IPA

Documented in print.IPA

### print.IPA.R --- 
#----------------------------------------------------------------------
## Author: Thomas Alexander Gerds
## Created: Nov  4 2019 (09:07) 
## Version: 
## Last-Updated: Sep  6 2023 (09:53) 
##           By: Thomas Alexander Gerds
##     Update #: 21
#----------------------------------------------------------------------
## 
### Commentary: 
## 
### Change Log:
#----------------------------------------------------------------------
## 
### Code:
##' Print method for IPA 
##'
##' @title Print IPA object
##' @param x Object obtained with \code{IPA}
##' @param digits Number of digits
##' @param ... passed to print
##' 
##' @method print IPA
##' @export 
##' @author Thomas A. Gerds <tag@@biostat.ku.dk>
print.IPA <- function(x,digits=2,...){
    Brier=IPA.drop=IPA=NULL
    if (missing(digits)){
        digits <- 1 
    }
    X <- data.table::copy(x)
    data.table::setDT(X)
    fmt <- paste0("%1.",digits[[1]],"f")
    X[,Brier:=sprintf(fmt=fmt,100*Brier)]
    X[,IPA:=sprintf(fmt=fmt,100*IPA)]
    if (match("IPA.drop",colnames(X),nomatch=0)) X[,IPA.drop:=sprintf(fmt=fmt,100*IPA.drop)]
    print(X,...)
    message("\nNOTE: Values are multiplied by 100 and given in %.")
    message("NOTE: The higher IPA the better.")
    message("NOTE: IPA.drop = IPA(Full model) - IPA. The higher the drop\nthe more important is the variable for the full model.")
}


######################################################################
### print.IPA.R ends here

Try the riskRegression package in your browser

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

riskRegression documentation built on Sept. 8, 2023, 6:12 p.m.