File: overview.Rmd

package info (click to toggle)
r-cran-tidyselect 1.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 556 kB
  • sloc: sh: 13; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 1,512 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

Tidyverse selections implement a dialect of R where operators make
it easy to select variables:

- `:` for selecting a range of consecutive variables.
- `!` for taking the complement of a set of variables.
- `&` and `|` for selecting the intersection or the union of two
  sets of variables.
- `c()` for combining selections.

In addition, you can use __selection helpers__. Some helpers select specific
columns:
* [`everything()`][tidyselect::everything]: Matches all variables.
* [`last_col()`][tidyselect::last_col]: Select last variable, possibly with an offset.

These helpers select variables by matching patterns in their names:
* [`starts_with()`][tidyselect::starts_with]: Starts with a prefix.
* [`ends_with()`][tidyselect::ends_with()]: Ends with a suffix.
* [`contains()`][tidyselect::contains()]: Contains a literal string.
* [`matches()`][tidyselect::matches()]: Matches a regular expression.
* [`num_range()`][tidyselect::num_range()]: Matches a numerical range like x01, x02, x03.

These helpers select variables from a character vector:
* [`all_of()`][tidyselect::all_of()]: Matches variable names in a character vector. All
  names must be present, otherwise an out-of-bounds error is
  thrown.
* [`any_of()`][tidyselect::any_of()]: Same as `all_of()`, except that no error is thrown
  for names that don't exist.

This helper selects variables with a function:
* [`where()`][tidyselect::where()]: Applies a function to all variables and selects those
  for which the function returns `TRUE`.