diff --git a/R/select_utilities.R b/R/select_utilities.R index 586d0ec7..a2a431f9 100644 --- a/R/select_utilities.R +++ b/R/select_utilities.R @@ -1,7 +1,17 @@ #' Convert formula selector to a named list #' -#' Functions takes a list of formulas, e.g. `list(starts_with("age") ~ "continuous")`, -#' and returns a named list, e.g. `list(age = "continuous")`. +#' Functions takes a list of formulas, a named list, or a combination of named +#' elements with formula elements and returns a named list. +#' For example, `list(age = 1, starts_with("stage") ~ 2)`. +#' +#' @section Shortcuts: +#' A shortcut for specifying an option be applied to all columns/variables +#' is omitting the LHS of the formula. +#' For example, `list(~ 1)` is equivalent to passing `list(everything() ~ 1)`. +#' +#' Additionally, a single formula may be passed instead of placing a single +#' formula in a list; e.g. `everything() ~ 1` is equivalent to +#' passing `list(everything() ~ 1)` #' #' @param x list of selecting formulas #' @inheritParams .select_to_varnames diff --git a/man/dot-formula_list_to_named_list.Rd b/man/dot-formula_list_to_named_list.Rd index ad60d9e0..c8b32203 100644 --- a/man/dot-formula_list_to_named_list.Rd +++ b/man/dot-formula_list_to_named_list.Rd @@ -27,6 +27,18 @@ helps in the error messaging. Default is NULL.} variable. Default is \code{FALSE}} } \description{ -Functions takes a list of formulas, e.g. \code{list(starts_with("age") ~ "continuous")}, -and returns a named list, e.g. \code{list(age = "continuous")}. +Functions takes a list of formulas, a named list, or a combination of named +elements with formula elements and returns a named list. +For example, \code{list(age = 1, starts_with("stage") ~ 2)}. } +\section{Shortcuts}{ + +A shortcut for specifying an option be applied to all columns/variables +is omitting the LHS of the formula. +For example, \code{list(~ 1)} is equivalent to passing \code{list(everything() ~ 1)}. + +Additionally, a single formula may be passed instead of placing a single +formula in a list; e.g. \code{everything() ~ 1} is equivalent to +passing \code{list(everything() ~ 1)} +} +