Skip to content

Move check_control() to control_parsnip.R #608

@EmilHvitfeldt

Description

@EmilHvitfeldt

This function would be more at home in https://github.com/tidymodels/parsnip/blob/main/R/control_parsnip.R

parsnip/R/fit.R

Lines 318 to 330 in dd36a95

check_control <- function(x) {
if (!is.list(x))
rlang::abort("control should be a named list.")
if (!isTRUE(all.equal(sort(names(x)), c("catch", "verbosity"))))
rlang::abort("control should be a named list with elements 'verbosity' and 'catch'.")
# based on ?is.integer
int_check <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol
if (!int_check(x$verbosity))
rlang::abort("verbosity should be an integer.")
if (!is.logical(x$catch))
rlang::abort("catch should be a logical.")
x
}

Metadata

Metadata

Assignees

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