@@ -91,15 +91,15 @@ set_env_val <- function(name, value) {
9191# ------------------------------------------------------------------------------
9292
9393check_eng_val <- function (eng ) {
94- if (rlang :: is_missing(eng ) || length(eng ) != 1 )
94+ if (rlang :: is_missing(eng ) || length(eng ) != 1 || ! is.character( eng ) )
9595 stop(" Please supply a character string for an engine name (e.g. `'lm'`)" ,
9696 call. = FALSE )
9797 invisible (NULL )
9898}
9999
100100
101101check_model_exists <- function (model ) {
102- if (rlang :: is_missing(model ) || length(model ) != 1 ) {
102+ if (rlang :: is_missing(model ) || length(model ) != 1 || ! is.character( model ) ) {
103103 stop(" Please supply a character string for a model name (e.g. `'linear_reg'`)" ,
104104 call. = FALSE )
105105 }
@@ -114,7 +114,7 @@ check_model_exists <- function(model) {
114114}
115115
116116check_model_doesnt_exist <- function (model ) {
117- if (rlang :: is_missing(model ) || length(model ) != 1 ) {
117+ if (rlang :: is_missing(model ) || length(model ) != 1 || ! is.character( model ) ) {
118118 stop(" Please supply a character string for a model name (e.g. `'linear_reg'`)" ,
119119 call. = FALSE )
120120 }
@@ -129,21 +129,21 @@ check_model_doesnt_exist <- function(model) {
129129}
130130
131131check_mode_val <- function (mode ) {
132- if (rlang :: is_missing(mode ) || length(mode ) != 1 )
132+ if (rlang :: is_missing(mode ) || length(mode ) != 1 || ! is.character( mode ) )
133133 stop(" Please supply a character string for a mode (e.g. `'regression'`)" ,
134134 call. = FALSE )
135135 invisible (NULL )
136136}
137137
138138check_engine_val <- function (eng ) {
139- if (rlang :: is_missing(eng ) || length(eng ) != 1 )
139+ if (rlang :: is_missing(eng ) || length(eng ) != 1 || ! is.character( eng ) )
140140 stop(" Please supply a character string for an engine (e.g. `'lm'`)" ,
141141 call. = FALSE )
142142 invisible (NULL )
143143}
144144
145145check_arg_val <- function (arg ) {
146- if (rlang :: is_missing(arg ) || length(arg ) != 1 )
146+ if (rlang :: is_missing(arg ) || length(arg ) != 1 || ! is.character( arg ) )
147147 stop(" Please supply a character string for the argument" ,
148148 call. = FALSE )
149149 invisible (NULL )
@@ -415,7 +415,7 @@ set_model_engine <- function(model, mode, eng) {
415415 dplyr :: distinct()
416416
417417 set_env_val(model , engs )
418-
418+ set_model_mode( model , mode )
419419 invisible (NULL )
420420}
421421
0 commit comments