@@ -54,39 +54,42 @@ mode_filter_condition <- function(mode, user_specified_mode) {
5454 rlang :: quo(mode == !! mode )
5555}
5656
57- # Model Specification Checking:
58- #
59- # The helpers `spec_is_possible()`, `spec_is_loaded()`, and
60- # `prompt_missing_implementation()` provide tooling for checking
61- # model specifications. In addition to the `spec`, `engine`, and `mode`
62- # arguments, the functions take arguments `user_specified_engine` and
63- # `user_specified_mode`, denoting whether the user themselves has
64- # specified the engine or mode, respectively.
65- #
66- # `spec_is_possible()` checks against the union of
67- #
68- # * the current parsnip model environment and
69- # * the `model_info_table` of "pre-registered" model specifications
70- #
71- # to determine whether a model is well-specified. See
72- # `parsnip:::read_model_info_table()` for this table.
73- #
74- # `spec_is_loaded()` checks only against the current parsnip model environment.
75- #
76- # `spec_is_possible()` is executed automatically on `new_model_spec()`,
77- # `set_mode()`, and `set_engine()`, and `spec_is_loaded()` is executed
78- # automatically in `print.model_spec()`, among other places. `spec_is_possible()`
79- # should be used when a model specification is still "in progress" of being
80- # specified, while `spec_is_loaded` should only be called when parsnip or an
81- # extension receives some indication that the user is "done" specifying a model
82- # specification: at print, fit, addition to a workflow, or `extract_*()`, for
83- # example.
84- #
85- # When `spec_is_loaded()` is `FALSE`, the `prompt_missing_implementation()`
86- # helper will construct an informative message to prompt users to load or
87- # install needed packages. It's `prompt` argument refers to the prompting
88- # function to use, usually [cli::cli_inform] or [cli::cli_abort], and the
89- # ellipses are passed to that function.
57+ # ' Model Specification Checking:
58+ # '
59+ # ' The helpers `spec_is_possible()`, `spec_is_loaded()`, and
60+ # ' `prompt_missing_implementation()` provide tooling for checking
61+ # ' model specifications. In addition to the `spec`, `engine`, and `mode`
62+ # ' arguments, the functions take arguments `user_specified_engine` and
63+ # ' `user_specified_mode`, denoting whether the user themselves has
64+ # ' specified the engine or mode, respectively.
65+ # '
66+ # ' `spec_is_possible()` checks against the union of
67+ # '
68+ # ' * the current parsnip model environment and
69+ # ' * the `model_info_table` of "pre-registered" model specifications
70+ # '
71+ # ' to determine whether a model is well-specified. See
72+ # ' `parsnip:::read_model_info_table()` for this table.
73+ # '
74+ # ' `spec_is_loaded()` checks only against the current parsnip model environment.
75+ # '
76+ # ' `spec_is_possible()` is executed automatically on `new_model_spec()`,
77+ # ' `set_mode()`, and `set_engine()`, and `spec_is_loaded()` is executed
78+ # ' automatically in `print.model_spec()`, among other places. `spec_is_possible()`
79+ # ' should be used when a model specification is still "in progress" of being
80+ # ' specified, while `spec_is_loaded` should only be called when parsnip or an
81+ # ' extension receives some indication that the user is "done" specifying a model
82+ # ' specification: at print, fit, addition to a workflow, or `extract_*()`, for
83+ # ' example.
84+ # '
85+ # ' When `spec_is_loaded()` is `FALSE`, the `prompt_missing_implementation()`
86+ # ' helper will construct an informative message to prompt users to load or
87+ # ' install needed packages. It's `prompt` argument refers to the prompting
88+ # ' function to use, usually [cli::cli_inform] or [cli::cli_abort], and the
89+ # ' ellipses are passed to that function.
90+ # ' @export
91+ # ' @keywords internal
92+ # ' @rdname extension-check-helpers
9093spec_is_possible <- function (spec ,
9194 engine = spec $ engine ,
9295 user_specified_engine = spec $ user_specified_engine ,
@@ -115,7 +118,10 @@ spec_is_possible <- function(spec,
115118 return (nrow(possibilities ) > 0 )
116119}
117120
118- # see notes above spec_is_possible for more information on usage
121+ # see ?add_on_exports for more information on usage
122+ # ' @export
123+ # ' @keywords internal
124+ # ' @rdname extension-check-helpers
119125spec_is_loaded <- function (spec ,
120126 engine = spec $ engine ,
121127 user_specified_engine = spec $ user_specified_engine ,
@@ -153,7 +159,10 @@ is_printable_spec <- function(x) {
153159# if there's a "pre-registered" extension supporting that setup,
154160# nudge the user to install/load it.
155161#
156- # see notes above spec_is_possible for more information on usage
162+ # see ?add_on_exports for more information on usage
163+ # ' @export
164+ # ' @keywords internal
165+ # ' @rdname extension-check-helpers
157166prompt_missing_implementation <- function (spec ,
158167 engine = spec $ engine ,
159168 user_specified_engine = spec $ user_specified_engine ,
0 commit comments