@@ -28,3 +28,39 @@ check_empty_ellipse <- function (...) {
2828
2929all_modes <- c(" classification" , " regression" )
3030
31+ model_printer <- function (x , ... ) {
32+ non_null_args <- x $ args [! vapply(x $ args , null_value , lgl(1 ))]
33+ if (length(non_null_args ) > 0 ) {
34+ cat(" Main Arguments:\n " )
35+ non_null_args <- lapply(non_null_args , as.character )
36+ non_null_args <- lapply(non_null_args , function (x )
37+ paste0(" " , x [- 1 ], " \n " ))
38+ anms <- names(non_null_args )
39+ non_null_args <- paste(anms , unlist(non_null_args ), sep = " : " )
40+ cat(non_null_args , sep = " " , " \n " )
41+ }
42+ if (length(x $ others ) > 0 ) {
43+ cat(" Engine-Specific Arguments:\n " )
44+ others <- lapply(x $ others , function (x ) paste(deparse(x ), sep = " \n " , collapse = " \n " ))
45+ others <- lapply(others , function (x )
46+ paste0(" " , x , " \n " ))
47+ onms <- names(others )
48+ others <- paste(onms , unlist(others ), sep = " : " )
49+ cat(others , sep = " " , " \n\n " )
50+ }
51+ if (! is.null(x $ engine )) {
52+ cat(" Computational engine:" , x $ engine , " \n\n " )
53+ if (! is.null(x $ method $ fit )) {
54+ cat(" Fit function:\n " )
55+ print(x $ method $ fit )
56+ if (length(x $ method $ library ) > 0 ) {
57+ if (length(x $ method $ library ) > 1 )
58+ cat(" \n Required packages:\n " )
59+ else
60+ cat(" \n Required package: " )
61+ cat(paste0(x $ method $ library , collapse = " , " ), " \n " )
62+ }
63+ }
64+ }
65+ cat(" \n " )
66+ }
0 commit comments