Skip to content

Commit

Permalink
document that input to recipes function can be sparse matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed Sep 10, 2024
1 parent 1928571 commit a9f8d0d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions R/recipe.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ recipe.default <- function(x, ...) {
#' Dots are allowed as are simple multivariate outcome terms (i.e. no need for
#' `cbind`; see Examples). A model formula may not be the best choice for
#' high-dimensional data with many columns, because of problems with memory.
#' @param x,data A data frame or tibble of the *template* data set
#' @param x,data A data frame, tibble, or sparse matrix from the `Matrix`
#' package of the *template* data set.
#' (see below).
#' @return An object of class `recipe` with sub-objects:
#' \item{var_info}{A tibble containing information about the original data
Expand Down Expand Up @@ -319,8 +320,8 @@ prep <- function(x, ...) {
#' For a recipe with at least one preprocessing operation, estimate the required
#' parameters from a training set that can be later applied to other data
#' sets.
#' @param training A data frame or tibble that will be used to estimate
#' parameters for preprocessing.
#' @param training A data frame, tibble, or sparse matrix from the `Matrix`
#' package, that will be used to estimate parameters for preprocessing.
#' @param fresh A logical indicating whether already trained operation should be
#' re-trained. If `TRUE`, you should pass in a data set to the argument
#' `training`.
Expand Down Expand Up @@ -601,9 +602,10 @@ bake <- function(object, ...) {
#' [prep()], apply the computations to new data.
#' @param object A trained object such as a [recipe()] with at least
#' one preprocessing operation.
#' @param new_data A data frame or tibble for whom the preprocessing will be
#' applied. If `NULL` is given to `new_data`, the pre-processed _training
#' data_ will be returned (assuming that `prep(retain = TRUE)` was used).
#' @param new_data A data frame, tibble, or sparse matrix from the `Matrix`
#' package for whom the preprocessing will be applied. If `NULL` is given to
#' `new_data`, the pre-processed _training data_ will be returned (assuming
#' that `prep(retain = TRUE)` was used).
#' @param ... One or more selector functions to choose which variables will be
#' returned by the function. See [selections()] for more details.
#' If no selectors are given, the default is to use
Expand Down
7 changes: 4 additions & 3 deletions man/bake.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/prep.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/recipe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9f8d0d

Please sign in to comment.