Skip to content

Instantly share code, notes, and snippets.

@gederajeg
Last active January 29, 2024 23:00
Show Gist options
  • Save gederajeg/b6c615c805d6a5c31d602c895f065776 to your computer and use it in GitHub Desktop.
Save gederajeg/b6c615c805d6a5c31d602c895f065776 to your computer and use it in GitHub Desktop.
Selecting column(s) whose contents match certain values

This is inspired by a post here for the use of tidyverse to retrieve column(s) whose contents match certain value.

df |> select(where(function(x) any(grepl(",", x))))

The code above retrives any column that has a comma in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment