Functions like starts_with(), contains() or matches() are selection helpers that only work in a selection context.

Examples of valid selection contexts are:

Using a selection helper anywhere else results in an error:



subset(mtcars, select = matches("foo"))

If you see this error, you've probably used a selection helper in the wrong place, possibly as the result of a typo (e.g. misplaced comma or wrong argument name).

tidyverse/tidyselect documentation built on Jan. 28, 2020, 1:13 a.m.