Facets_in_snpR | R Documentation |
Facets are used to describe the ways in which data should be broken down/split up for analysis.
Facet designation follows a specific format. Facets are given as a character vector, where each entry designates one unique combination of levels over which to separate the data. Levels within a facet are separated by a '.'. Each facet can contain multiple snp and/or sample levels. Multiple facets can be run with a single line of code.
For example, c("chr.pop", "pop") would split the data first by both chr and pop and then by pop alone. This will produce the same result as running the function with both "chr.pop" and then again with "pop", although the former is typically more computationally efficient.
If multiple sample or snp levels are provided in a single facet, the data is
simultaneously broken up by both levels. For example, the facet
c("fam.pop") would break up the data provided in stickSNPs
by
both family and population, and would produce levels such as "ASP.A" for
individuals in the ASP population and in family A.
All listed facet levels must match column names in the snp of sample level
facet data provided when constructing a snpRdata object with
import.snpR.data
. The order of the provided levels within each
facet does not matter.
In many cases, specifying "all" as a facet will calculate or return statistics for all previously run facets.
The base facet–that is, the entire data with no categorical divisions–can be specified with ".base" and is typically the facet defaulted to when facets = NULL.
See examples.
# base facet
x <- calc_pi(stickSNPs)
get.snpR.stats(x)
## Not run:
# multiple facets
x <- calc_pi(stickSNPs, facets = c("pop", "pop.fam"))
get.snpR.stats(x, c("pop", "pop.fam"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.