# load simulated admixture data
data("xadmixture")
# keep only observations with K1 > 0.1 and K2 > 0.01
subset1 <- admix_subset(xadmixture,
anc = c("K1", "K2"),
pct = c(0.1, 0.01))
# keep only observations with K2 < 0.4 and K3 < 0.1
subset2 <- admix_subset(xadmixture,
anc = c("K2", "K3"),
pct = c(0.4, 0.1),
comparison = "less")
# keep only observations with values "GBR" or "FRA" in column
# "country" and values "lorem" or "dolor" in column "species"
subset3 <- admix_subset(xadmixture,
country = c("GBR", "FRA"),
species = c("lorem", "dolor"))
# keep only observations with K1 > 0.1 and K4 < 0.3,
# without printing progress; subsets can be chained
# using the pipe operator from package `magrittr`
library(magrittr)
subset4 <- admix_subset(xadmixture,
anc = "K1",
pct = 0.1,
quiet = TRUE) %>%
admix_subset(anc = "K4",
pct = 0.3,
comparison = "less",
quiet = TRUE)
Run the code above in your browser using DataLab