@@ -52,3 +52,35 @@ check_installs <- function(x) {
5252 }
5353 }
5454}
55+
56+ # ' Declare a computational engine and specific arguments
57+ # '
58+ # ' `set_engine` is used to specify which package or system will be used
59+ # ' to fit the model, along with any arguments specific to that software.
60+ # '
61+ # ' @param object A model specification.
62+ # ' @param engine A character string for the software that should
63+ # ' be used to fit the model. This is highly dependent on the type
64+ # ' of model (e.g. linear regression, random forest, etc.).
65+ # ' @param ... Any optional arguments associated with the chosen computational
66+ # ' engine. These are captured as quosures and can be `varying()`.
67+ # ' @return An updated model specification.
68+ # ' @examples
69+ # ' # First, set general arguments using the standardized names
70+ # ' mod <-
71+ # ' logistic_reg(mixture = 1/3) %>%
72+ # ' # now say how you want to fit the model and another other options
73+ # ' set_engine("glmnet", nlambda = 10)
74+ # ' translate(mod, engine = "glmnet")
75+ # ' @export
76+ set_engine <- function (object , engine , ... ) {
77+ if (! is.character(engine ) | length(engine ) != 1 )
78+ stop(" `engine` should be a single character value." , call. = FALSE )
79+
80+ object $ engine <- engine
81+ object <- check_engine(object )
82+
83+
84+ object $ others <- enquos(... )
85+ object
86+ }
0 commit comments