@@ -72,30 +72,38 @@ organize_data.tune_results <-
7272 }
7373# ------------------------------------------------------------------------------
7474
75- new_shiny_data <- function (predictions , y_name , subclass , numeric_cols , factor_cols , x , default_config ) {
76- if (! inherits(predictions , " data.frame" )) {
77- cli :: cli_abort(" {.arg predictions} should be a data frame." )
78- }
75+ new_shiny_data <- function (predictions ,
76+ y_name ,
77+ subclass ,
78+ numeric_cols ,
79+ factor_cols ,
80+ x ,
81+ default_config ,
82+ call = caller_env()) {
83+ check_inherits(predictions , " data.frame" , call = call )
7984 if (nrow(predictions ) == 0 ) {
80- cli :: cli_abort(" There should be at least one row of predictions." )
85+ cli :: cli_abort(
86+ " There should be at least one row of predictions." ,
87+ call = call
88+ )
8189 }
90+ check_string(y_name , allow_empty = FALSE , call = call )
8291 if (! (y_name %in% names(predictions ))) {
83- cli :: cli_abort(" {.field {y_name}} should be a column in the predictions." )
84- }
85- if (! is.character(y_name )) {
86- cli :: cli_abort(" {.arg y_name} should be a character string." )
87- }
88- if (! is.character(numeric_cols )) {
89- cli :: cli_abort(" {.arg numeric_cols} should be a character string." )
90- }
91- if (! is.character(factor_cols )) {
92- cli :: cli_abort(" {.arg factor_cols} should be a character string." )
93- }
94- if (! is.character(default_config )) {
95- cli :: cli_abort(" {.arg default_config} should be a character string." )
92+ cli :: cli_abort(
93+ " {.field {y_name}} should be a column in the predictions." ,
94+ call = call
95+ )
9696 }
97+
98+ check_inherits(numeric_cols , " character" , call = call )
99+ check_inherits(factor_cols , " character" , call = call )
100+ check_inherits(default_config , " character" , call = call )
101+
97102 if (! (default_config %in% predictions $ .config )) {
98- cli :: cli_abort(" {.arg default_config} should be a character string in predictions." )
103+ cli :: cli_abort(
104+ " {.arg default_config} should be a character string in predictions." ,
105+ call = call
106+ )
99107 }
100108 res <- list (
101109 predictions = predictions ,
0 commit comments