Skip to content

Instantly share code, notes, and snippets.

@brshallo
Created November 22, 2021 19:19
Show Gist options
  • Select an option

  • Save brshallo/f0cdfd38f31947b5edbe3efd8efab036 to your computer and use it in GitHub Desktop.

Select an option

Save brshallo/f0cdfd38f31947b5edbe3efd8efab036 to your computer and use it in GitHub Desktop.
library(tidyverse)
set.seed(1234)
data <- map(1:3, ~runif(10)) %>%
set_names(paste0("x", 1:3)) %>%
as_tibble() %>%
mutate(letters = letters[1:10])
data
# keep rows where all are above threshold
filter(data, if_all(where(is.double), ~ .x > 0.6))
# keep rows where any are above threshold
filter(data, if_any(where(is.double), ~ .x > 0.6))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment