Skip to content

Commit

Permalink
Merge pull request #1230 from tidymodels/document-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt authored Oct 5, 2023
2 parents 98462fd + f001888 commit ece92e5
Show file tree
Hide file tree
Showing 187 changed files with 1,609 additions and 478 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Document that `update_role()`, `add_role()` and `remove_role()` are applied before steps and checks. (#778)

* Documentation for tidy methods for all steps has been added when missing and improved to describe the return value more accurately. (#936)

# recipes 1.0.8

## Improvements
Expand Down
11 changes: 8 additions & 3 deletions R/BoxCox.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns
#' `terms` (the selectors or variables selected) and `value` (the
#' lambda estimate) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `value` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{value}{numeric, the lambda estimate}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
Expand Down
11 changes: 8 additions & 3 deletions R/YeoJohnson.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns
#' `terms` (the selectors or variables selected) and `value` (the
#' lambda estimate) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `value` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{value}{numeric, the lambda estimate}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
Expand Down
13 changes: 8 additions & 5 deletions R/arrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
#' to embed the value of the object in the expression (to
#' be portable between sessions). See the examples.
#'
#' # Tidying
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with column
#' `terms` which contains the sorting variable(s) or expression(s) is
#' returned. The expressions are text representations and are not
#' parsable.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms` and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
Expand Down
11 changes: 8 additions & 3 deletions R/bin2factor.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@
#' density of numeric binary data. Note that the numeric data is
#' only verified to be numeric (and does not count levels).
#'
#' # Tidying
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with column
#' `terms` (the columns that will be affected) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms` and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
Expand Down
11 changes: 8 additions & 3 deletions R/bs.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@
#' from the data and new columns are added. The naming convention
#' for the new variables is `varname_bs_1` and so on.
#'
#' # Tidying
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with column
#' `terms` (the columns that will be affected) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms` and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{id}{character, id of this step}
#' }
#'
#' ```{r, echo = FALSE, results="asis"}
#' step <- "step_bs"
Expand Down
13 changes: 9 additions & 4 deletions R/center.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@
#' argument of `prep.recipe`. `bake.recipe` then applies
#' the centering to new data sets using these means.
#'
#' # Tidying
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns
#' `terms` (the selectors or variables selected) and `value` (the means)
#' is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `value`, and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{value}{numeric, the means}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-unsupervised
#'
Expand Down
12 changes: 9 additions & 3 deletions R/classdist.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns
#' `terms` (the selectors or variables selected), `value` (the centroid
#' of the class), and `class` is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `value`, `class` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{value}{numeric, location of centroid}
#' \item{class}{character, name of the class}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-supervised
#'
Expand Down
19 changes: 14 additions & 5 deletions R/classdist_shrunken.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,20 @@
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns
#' `terms` (the selectors or variables selected), `value` (the centroid),
#' `class`, and `type` is returned. Type has values `"global"`, `"by_class"`,
#' and `"shrunken"`. The first two types of centroids are in the original units
#' while the last have been standardized.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `value`, `class`, `type`, `threshold` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{value}{numeric, the centroid}
#' \item{class}{character, name of class variable}
#' \item{type}{character, has values `"global"`, `"by_class"`, and `"shrunken"`}
#' \item{threshold}{numeric, value of threshold}
#' \item{id}{character, id of this step}
#' }
#'
#' The first two types of centroids are in the original units while the last
#' has been standardized.
#'
#' @template case-weights-supervised
#' @references
Expand Down
9 changes: 7 additions & 2 deletions R/corr.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with column
#' `terms` (the columns that will be removed) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms` and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected to be removed}
#' \item{id}{character, id of this step}
#' }
#'
#' ```{r, echo = FALSE, results="asis"}
#' step <- "step_corr"
Expand Down
11 changes: 8 additions & 3 deletions R/count.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns
#' `terms` (the selectors or variables selected) and `result` (the
#' new column name) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `result` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{result}{character, the new column names}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
Expand Down
11 changes: 11 additions & 0 deletions R/cut.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@
#' `step_cut()` will call `base::cut()` in the baking step with
#' `include.lowest` set to `TRUE`.
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `value` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{value}{character, the location of the cuts}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
#' @examples
Expand Down
12 changes: 12 additions & 0 deletions R/date.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@
#' `terms` (the selectors or variables selected), `value` (the feature
#' names), and `ordinal` (a logical) is returned.
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `value`, `ordinal` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{value}{character, the feature names}
#' \item{ordinal}{logical, are factors ordered}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
#' @examples
Expand Down
12 changes: 9 additions & 3 deletions R/depth.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@
#' replace the original values and by default have the prefix `depth_`. The
#' naming format can be changed using the `prefix` argument.
#'
#' # Tidying
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns
#' `terms` (the selectors or variables selected) and `class` is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `class` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{class}{character, name of class variable}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
Expand Down
11 changes: 8 additions & 3 deletions R/discretize.R
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,14 @@ print.discretize <-
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns
#' `terms` (the selectors or variables selected) and `value`
#' (the breaks) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `value` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{value}{numeric, the breaks}
#' \item{id}{character, id of this step}
#' }
#'
#' ```{r, echo = FALSE, results="asis"}
#' step <- "step_discretize"
Expand Down
11 changes: 8 additions & 3 deletions R/dummy.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
#' (the selectors or original variables selected) and `columns` (the list of
#' corresponding binary columns) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `columns` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{columns}{character, names of resulting columns}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
Expand Down
16 changes: 11 additions & 5 deletions R/dummy_extract.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@
#'
#' @details
#'
#' # Tidying
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns
#' `terms` (the selectors or original variables selected) and `columns`
#' (the list of corresponding columns) is returned. The `columns` is
#' is ordered according the frequency in the training data set.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `columns` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{columns}{character, names of resulting columns}
#' \item{id}{character, id of this step}
#' }
#'
#' The return value is ordered according to the frequency of `columns` entries in the training data set.
#'
#' @template case-weights-unsupervised
#'
Expand Down
11 changes: 11 additions & 0 deletions R/dummy_multi_choice.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
#' cat(result)
#' ```
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms`, `columns` , and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{columns}{character, names of resulting columns}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
#' @examples
Expand Down
9 changes: 7 additions & 2 deletions R/factor2string.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
#' (the columns that will be affected) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms` and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{id}{character, id of this step}
#' }
#'
#' @template case-weights-not-supported
#'
Expand Down
14 changes: 10 additions & 4 deletions R/filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@
#' the value of the object in the expression (to be portable
#' between sessions). See the examples.
#'
#' # Tidying
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with column
#' `terms` which contains the conditional statements is returned.
#' These expressions are text representations and are not parsable.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms` and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{id}{character, id of this step}
#' }
#'
#' The expressions in `terms` are text representations and are not parsable.
#'
#' @template case-weights-not-supported
#'
#' @family row operation steps
Expand Down
9 changes: 7 additions & 2 deletions R/filter_missing.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
#'
#' # Tidying
#'
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with column
#' `terms` (the columns that will be removed) is returned.
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is returned with
#' columns `terms` and `id`:
#'
#' \describe{
#' \item{terms}{character, the selectors or variables selected}
#' \item{id}{character, id of this step}
#' }
#'
#' ```{r, echo = FALSE, results="asis"}
#' step <- "step_filter_missing"
Expand Down
Loading

0 comments on commit ece92e5

Please sign in to comment.