Facets_in_snpR: Facets in snpR

Facets_in_snpRR Documentation

Facets in snpR

Description

Facets are used to describe the ways in which data should be broken down/split up for analysis.

Details

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.

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)

hemstrow/snpR documentation built on March 20, 2024, 7:03 a.m.