@@ -80,8 +80,9 @@ pred_types <-
80
80
# ' @param items A character string of objects in the model environment.
81
81
# ' @param pre,post Optional functions for pre- and post-processing of prediction
82
82
# ' results.
83
- # ' @param ... Optional arguments that should be passed into the `args` slot for
84
- # ' prediction objects
83
+ # ' @param ... For `pred_value_template()`: optional arguments that should be
84
+ # ' passed into the `args` slot for prediction objects. For `set_in_env()`,
85
+ # ' named values that will be assigned to the model environment.
85
86
# ' @keywords internal
86
87
# ' @details These functions are available for users to add their
87
88
# ' own models or engines (in package or otherwise) so that they can
@@ -696,8 +697,6 @@ show_model_info <- function(model) {
696
697
} else {
697
698
cat(" no registered prediction modules.\n\n " )
698
699
}
699
-
700
-
701
700
invisible (NULL )
702
701
}
703
702
@@ -709,6 +708,24 @@ get_from_env <- function(items) {
709
708
rlang :: env_get(mod_env , items )
710
709
}
711
710
711
+ # ' @rdname get_model_env
712
+ # ' @keywords internal
713
+ # ' @export
714
+ set_in_env <- function (... ) {
715
+ mod_env <- get_model_env()
716
+ rlang :: env_bind(mod_env , ... )
717
+ }
718
+
719
+ # ' @rdname get_model_env
720
+ # ' @keywords internal
721
+ # ' @export
722
+ set_env_val <- function (name , value ) {
723
+ mod_env <- parsnip :: get_model_env()
724
+ x <- list (value )
725
+ names(x ) <- name
726
+ rlang :: env_bind(mod_env , !!! x )
727
+ }
728
+
712
729
# ------------------------------------------------------------------------------
713
730
714
731
# ' @rdname get_model_env
0 commit comments