View source: R/loci_missingness.R
loci_missingness | R Documentation |
Estimate the rate of missingness at each locus. This function has an
efficient method to support grouped gen_tibble
objects, which can return a
tidied tibble, a list, or a matrix.
loci_missingness(
.x,
.col = "genotypes",
as_counts = FALSE,
n_cores = bigstatsr::nb_cores(),
block_size,
type,
...
)
## S3 method for class 'tbl_df'
loci_missingness(
.x,
.col = "genotypes",
as_counts = FALSE,
n_cores = n_cores,
block_size = bigstatsr::block_size(nrow(.x), 1),
...
)
## S3 method for class 'vctrs_bigSNP'
loci_missingness(
.x,
.col = "genotypes",
as_counts = FALSE,
n_cores = n_cores,
block_size = bigstatsr::block_size(length(.x), 1),
...
)
## S3 method for class 'grouped_df'
loci_missingness(
.x,
.col = "genotypes",
as_counts = FALSE,
n_cores = bigstatsr::nb_cores(),
block_size = bigstatsr::block_size(nrow(.x), 1),
type = c("tidy", "list", "matrix"),
...
)
.x |
a vector of class |
.col |
the column to be used when a tibble (or grouped tibble is passed directly to the function). This defaults to "genotypes" and can only take that value. There is no need for the user to set it, but it is included to resolve certain tidyselect operations. |
as_counts |
boolean defining whether the count of NAs (rather than the rate) should be returned. It defaults to FALSE (i.e. rates are returned by default). |
n_cores |
number of cores to be used, it defaults to
|
block_size |
maximum number of loci read at once. |
type |
type of object to return, if using grouped method. One of "tidy", "list", or "matrix". Default is "tidy". |
... |
other arguments passed to specific methods. |
a vector of frequencies, one per locus
example_gt <- load_example_gt("gen_tbl")
# For missingness
example_gt %>% loci_missingness()
# For missingness per locus per population
example_gt %>%
group_by(population) %>%
loci_missingness()
# alternatively, return a list of populations with their missingness
example_gt %>%
group_by(population) %>%
loci_missingness(type = "list")
# or a matrix with populations in columns and loci in rows
example_gt %>%
group_by(population) %>%
loci_missingness(type = "matrix")
# or within reframe (not recommended, as it much less efficient
# than using it directly as shown above)
example_gt %>%
group_by(population) %>%
reframe(missing = loci_missingness(genotypes))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.