Skip to content

Commit ad66cec

Browse files
authored
Merge pull request #405 from daltonkw/parameters-improve-doc
Improve documentation for parameters().
2 parents 62fe01e + 40e9590 commit ad66cec

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

R/parameters.R

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
#' Information on tuning parameters within an object
1+
#' Create a parameter set
22
#'
33
#' @param x An object, such as a list of `param` objects or an actual `param`
4-
#' object.
4+
#' object.
55
#' @param ... Only used for the `param` method so that multiple `param` objects
6-
#' can be passed to the function.
6+
#' can be passed to the function.
7+
#'
8+
#' @return
9+
#' A parameter set of class `parameters` in the form of a data frame where each
10+
#' row represents one tunable parameter.
11+
#'
12+
#' @seealso [dials::update.parameters()], [dials::finalize()],
13+
#' [hardhat::extract_parameter_set_dials()]
14+
#'
15+
#' @examples
16+
#' params <- list(lambda = penalty(), alpha = mixture(), `rand forest` = mtry())
17+
#' pset <- parameters(params)
18+
#' pset
19+
#'
720
#' @export
821
parameters <- function(x, ...) {
922
UseMethod("parameters")
@@ -177,12 +190,13 @@ print.parameters <- function(x, ...) {
177190
print_x$object <-
178191
purrr::map_chr(
179192
print_x$object,
180-
\(.x)
193+
\(.x) {
181194
if (all(is.na(.x))) {
182195
"missing"
183196
} else {
184197
pillar::type_sum(.x)
185198
}
199+
}
186200
)
187201

188202
cli::cli_par()

man/parameters.Rd

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)