Skip to content

Commit 51734c4

Browse files
authored
Merge pull request #583 from tidymodels/doc-tools
Update how-to for engine documentation
2 parents 679c249 + 4c8f726 commit 51734c4

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

R/aaa_models.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,11 +1054,11 @@ get_encoding <- function(model) {
10541054
#' based on which parsnip-related packages are loaded by the user.
10551055
#'
10561056
#' These functions can be used to make dynamic lists of documentation help
1057-
#' files. \pkg{parsnip} uses these, along with files contained in `man/rmd`
1058-
#' containing expanded documentation, for specific model/engine combinations.
1057+
#' files. \pkg{parsnip} uses these along with files in `man/rmd` which
1058+
#' contain expanded documentation for specific model/engine combinations.
10591059
#' [find_engine_files()] looks for files that have the pattern
10601060
#' `details_{model}_{engine}.Rd` to link to. These files are generated by files
1061-
#' named `man/rmd/details_{model}_{engine}.Rmd`. `make_engine_list()` creates a
1061+
#' named `man/rmd/{model}_{engine}.Rmd`. `make_engine_list()` creates a
10621062
#' list seen at the top of the model Rd files while `make_seealso_list()`
10631063
#' populates the list seen in "See Also" below. See the details section.
10641064
#'
@@ -1083,18 +1083,18 @@ get_encoding <- function(model) {
10831083
#'
10841084
#' 1. Create an engine-specific R file in the `R` directory with the name
10851085
#' `{model}_{engine}.R` (e.g. `boost_tree_C5.0.R`). This has a small amount of
1086-
#' documentation, as well as the directive
1087-
#' "`@includeRmd man/rmd/{model}_{engine}.Rmd details`".
1086+
#' documentation, as well as the directives "`@name details_{model}_{engine}`"
1087+
#' and "`@includeRmd man/rmd/{model}_{engine}.Rmd details`".
10881088
#'
1089-
#' 1. Copy the file in \pkg{parsnip} that is in `man/rmd/setup.Rmd` and put
1089+
#' 2. Copy the file in \pkg{parsnip} that is in `man/rmd/setup.Rmd` and put
10901090
#' it in the same place in your package.
10911091
#'
1092-
#' 1. Write your own `man/rmd/{model}_{engine}.Rmd` file. This can include
1092+
#' 3. Write your own `man/rmd/{model}_{engine}.Rmd` file. This can include
10931093
#' packages that are not listed in the DESCRIPTION file. Those are only
10941094
#' required when the documentation file is created locally (probably using
1095-
#' [devtools::document()].
1095+
#' [devtools::document()]).
10961096
#'
1097-
#' 1. Run [devtools::document()] so that the Rmd content is included in the
1097+
#' 4. Run [devtools::document()] so that the Rmd content is included in the
10981098
#' Rd file.
10991099
#'
11001100
#' The examples in \pkg{parsnip} can provide guidance for how to organize

man/doc-tools.Rd

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

man/rmd/setup.Rmd

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ convert_args <- function(model_name) {
1515
dplyr::filter(grepl(model_name, model)) %>%
1616
tidyr::unnest(args) %>%
1717
dplyr::select(model:original) %>%
18-
full_join(get_arg_defaults(model_name),
19-
by = c("model", "engine", "parsnip", "original")) %>%
20-
mutate(original = dplyr::if_else(!is.na(default),
21-
paste0(original, " (", default, ")"),
22-
original)) %>%
23-
select(-default)
18+
dplyr::full_join(get_arg_defaults(model_name),
19+
by = c("model", "engine", "parsnip", "original")) %>%
20+
dplyr::mutate(original = dplyr::if_else(!is.na(default),
21+
paste0(original, " (", default, ")"),
22+
original)) %>%
23+
dplyr::select(-default)
2424
2525
convert_df <- args %>%
2626
dplyr::select(-model) %>%
@@ -53,11 +53,11 @@ get_dials <- function(x) {
5353
}
5454
5555
descr_models <- function(mod, eng) {
56-
res <- get_from_env(mod) %>%
57-
dplyr::filter(engine == eng) %>%
58-
dplyr::distinct() %>%
56+
res <- get_from_env(mod) %>%
57+
dplyr::filter(engine == eng) %>%
58+
dplyr::distinct() %>%
5959
purrr::pluck("mode")
60-
60+
6161
if (length(res) == 1) {
6262
txt <- "is a single mode:"
6363
} else {

0 commit comments

Comments
 (0)