Last active
July 6, 2018 20:09
-
-
Save sjessa/842cdc4b9d07669fd8b2fd054970d514 to your computer and use it in GitHub Desktop.
Filter a data frame based on a set of expressions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filters | |
library(tidyverse) | |
sample_filters <- quos(project %in% c("dev", species %in% c("mouse"))) | |
sample_list <- data.frame( | |
project = c("dev", "pbt"), | |
species = c("mouse", "human"), | |
dont_filter = c("a", "b")) | |
sample_list %>% filter(!!! sample_filters) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment