library(DImodels)
library(dplyr)
## Load data
data(sim3)
# The special filter keywords should be specified as a string
# Filter communities containing 3 species
head(custom_filter(data = sim3, prop = 4:12,
special = "richness == 3"))
# Filter communities at richness 6 OR evenness 0
head(custom_filter(data = sim3, prop = 4:12,
special = "richness == 6 | evenness == 0"), 12)
# Filter all monoculture AND treatment "A" (treatment is column present in data)
head(custom_filter(data = sim3, prop = 4:12,
special = "monos == TRUE & treatment == 'A'"), 10)
# Filter all equi proportional communities but NOT monocultures
head(custom_filter(data = sim3, prop = 4:12,
special = "equi == TRUE & monos == FALSE"))
# Can also use normal filter
sim3 %>% custom_filter(p1 == 1, special = NULL, prop = NULL)
# Both special filtering and normal filtering can be combined as well
sim3 %>% custom_filter(prop = paste0("p", 1:9),
special = "richness == 1",
community %in% c(7, 9))
Run the code above in your browser using DataLab