largeRCRF/R/misc.R
Joel Therrien a9e65edad3 Slight cleanup
No more warnings from devtools::check()
2019-06-30 15:41:33 -07:00

58 lines
1.8 KiB
R

# Internal function
convertRListToJava <- function(lst){
javaList <- .jnew(.class_ArrayList, as.integer(length(lst)))
javaList <- .jcast(javaList, .class_List)
for (item in lst){
if (class(item) != "jobjRef" & class(item) != "jarrayRef"){
stop("All items in the list must be rJava Java objects")
}
.jcall(javaList, "Z", "add", .jcast(item, .class_Object))
}
return(javaList)
}
#' @export
print.SplitFinder = function(x, ...) print(x$call)
#' @export
print.ResponseCombiner = function(x, ...) print(x$call)
#' @export
print.JRandomForest <- function(x, ...){
cat("Call:\n")
print(x$call)
cat("\nParameters:\n")
cat("\tSplit Finder: "); print(x$params$splitFinder$call)
cat("\tTerminal Node Response Combiner: "); print(x$params$nodeResponseCombiner$call)
cat("\tForest Response Combiner: "); print(x$params$forestResponseCombiner$call)
cat("\t# of trees: "); cat(x$params$ntree); cat("\n")
cat("\t# of Splits: "); cat(x$params$numberOfSplits); cat("\n")
cat("\t# of Covariates to try: "); cat(x$params$mtry); cat("\n")
cat("\tNode Size: "); cat(x$params$nodeSize); cat("\n")
cat("\tMax Node Depth: "); cat(x$params$maxNodeDepth); cat("\n")
cat("Try using me with predict() or one of the relevant commands to determine error\n")
}
#' @export
print.CompetingRiskFunctions.List <- function(x, ...){
cat("Number of predictions: ")
cat(length(x))
cat("\n\nSee the help page ?CompetingRiskPredictions for a list of relevant functions on how to use this object.\n")
}
#' @export
print.CompetingRiskFunctions <- function(x, ...){
mx <- ncol(x$cif)
cat(mx); cat(" CIFs available\n")
cat(mx); cat(" CHFs available\n")
cat("An overall survival curve available\n")
cat("\nSee the help page ?CompetingRiskPredictions for a list of relevant functions on how to use this object.\n")
}