Skip to content

Commit

Permalink
example, docs
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Feb 7, 2024
1 parent 3869b37 commit 513341c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
15 changes: 13 additions & 2 deletions R/data_modify.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
#'
#' @param .at A character vector of variable names that should be modified. This
#' argument is used in combination with the `.modify` argument. Note that only one
#' of `.at` or `.if` can be provided, but not both at the same time.
#' of `.at` or `.if` can be provided, but not both at the same time. Newly created
#' variables in `...` are not affected by `.at`.
#' @param .if A function that returns `TRUE` for columns in the data frame where
#' `.if` applies. This argument is used in combination with the `.modify` argument.
#' Note that only one of `.at` or `.if` can be provided, but not both at the same
#' time.
#' time. Newly created variables in `...` are not affected by `.if`.
#' @param .modify A function that modifies the variables defined in `.at` or `.if`.
#' This argument is used in combination with either the `.at` or the `.if` argument.
#' Note that the modified variable (i.e. the result from `.modify`) must be either
Expand Down Expand Up @@ -112,6 +113,16 @@
#' # can be combined with dots
#' data_modify(d, new_length = Petal.Length * 2, .at = "Species", .modify = as.numeric)
#'
#' # note that new variables cannot be used in `.at` or `.if` arguments
#' # this example would throw an error
#' \dontrun{
#' data_modify(
#' d,
#' new_length = Petal.Length * 2,
#' .at = c("Species", "new_length"),
#' .modify = as.numeric
#' )}
#'

Check warning on line 125 in R/data_modify.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/data_modify.R,line=125,col=3,[trailing_whitespace_linter] Remove trailing whitespace.
#' # combine "data_find()" and ".at" argument
#' out <- data_modify(
#' d,
Expand Down
15 changes: 13 additions & 2 deletions man/data_modify.Rd

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

0 comments on commit 513341c

Please sign in to comment.