View source: R/select_loci_if.R
select_loci_if | R Documentation |
select_if
verb for loci
An equivalent to dplyr::select_if()
that works on the genotype
column
of a gen_tibble
. This function has access to the genotypes (and thus can
work on summary statistics to select), but not the names of the loci (look
at select_loci()
for that feature.
select_loci_if(.data, .sel_logical)
.data |
a |
.sel_logical |
a logical vector of length equal to the number of loci, or an expression that will tidy evaluate to such a vector. Only loci for which .sel_logical is TRUE will be selected; NA will be treated as FALSE. |
#' Note that the select_loci_if
verb does not modify the backing FBM files,
but rather it subsets the list of loci to be used stored in the gen_tibble
.
a subset of the list of loci in the gen_tibble
example_gt <- load_example_gt("gen_tbl")
# Select loci by chromosome
example_gt_subset <- example_gt %>%
select_loci_if(loci_chromosomes(genotypes) == "chr2")
show_loci(example_gt_subset)
# Select loci by a summary statistic
example_gt_subset <- example_gt %>%
select_loci_if(loci_maf(genotypes) > 0.2)
show_loci(example_gt_subset)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.