Skip to content

Commit 666e62d

Browse files
charliejhadleyhadley
authored andcommitted
Provide examples of tidyselect specification (#768)
Fixes #778
1 parent c73979d commit 666e62d

File tree

6 files changed

+29
-8
lines changed

6 files changed

+29
-8
lines changed

R/pivot-long.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
#' under active development.
1717
#'
1818
#' @param data A data frame to pivot.
19-
#' @param cols Columns to pivot into longer format. This takes a tidyselect
20-
#' specification.
19+
#' @param cols Columns to pivot into longer format.
20+
#'
21+
#' This takes a tidyselect specification, e.g. use `a:c` to select all
22+
#' columns from `a` to `c`, `starts_with("prefix")` to select all columns
23+
#' starting with "prefix", or `everything()` to select all columns.
2124
#' @param names_to A string specifying the name of the column to create
2225
#' from the data stored in the column names of `data`.
2326
#'

R/pivot-wide.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#' Defaults to all columns in `data` except for the columns specified in
2323
#' `names_from` and `values_from`. Typically used when you have additional
2424
#' variables that is directly related.
25+
#'
26+
#' This takes a tidyselect specification, e.g. use `a:c` to select all
27+
#' columns from `a` to `c`, `starts_with("prefix")` to select all columns
28+
#' starting with "prefix", or `everything()` to select all columns.
2529
#' @param names_from,values_from A pair of arguments describing which column
2630
#' (or columns) to get the name of the output column (`name_from`), and
2731
#' which column (or columns) to get the cell values from (`values_from`).

man/pivot_longer.Rd

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

man/pivot_longer_spec.Rd

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

man/pivot_wider.Rd

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

man/pivot_wider_spec.Rd

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

0 commit comments

Comments
 (0)