Skip to content

Unexport check_model_exists() and check_model_doesnt_exists() #820

@EmilHvitfeldt

Description

@EmilHvitfeldt

As far as I can tell, check_model_exists() and check_model_doesnt_exists() doesn't need to be exported, and isn't being used outside of parsnip

Code:

parsnip/R/aaa_models.R

Lines 126 to 156 in b74e6e4

#' @rdname set_new_model
#' @export
check_model_exists <- function(model) {
if (rlang::is_missing(model) || length(model) != 1 || !is.character(model)) {
rlang::abort("Please supply a character string for a model name (e.g. `'linear_reg'`)")
}
current <- get_model_env()
if (!any(current$models == model)) {
rlang::abort(glue::glue("Model `{model}` has not been registered."))
}
invisible(NULL)
}
#' @rdname set_new_model
#' @export
check_model_doesnt_exist <- function(model) {
if (rlang::is_missing(model) || length(model) != 1 || !is.character(model)) {
rlang::abort("Please supply a character string for a model name (e.g. `'linear_reg'`)")
}
current <- get_model_env()
if (any(current$models == model)) {
rlang::abort(glue::glue("Model `{model}` already exists"))
}
invisible(NULL)
}

Github searches:

https://github.com/search?q=parsnip+check_model_exists&type=code

https://github.com/search?q=parsnip+check_model_doesnt_exist&type=code

Metadata

Metadata

Assignees

No one assigned

    Labels

    upkeepmaintenance, infrastructure, and similar

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions