View source: R/distance_identities.R
distance_identities | R Documentation |
Calculates the probability of observing identical genotypes at different distances along a transect.
distance_identities(genotypes, positions, labels = 1:length(positions))
genotypes |
Vector of genotypes occupying each sampling point. Alternatively a list of vectors can be provided. Each element in the list should be a 1-d vector with an element for every sampling point along the transect, with each element the genotype observed at that sampliong point. |
positions |
1-d vector of positions along the transect. This should be
the same length of each vector in |
labels |
Optional vector of labels for each sampling point. Defaults to integers. |
distance_identities
calculates how often pairs of identical genotypes are
observed for all possible distances between sampling points along a transect.
Identities are averaged over multiple years for a transect.
Returns a data.frame with a row for each pair of sampling points.
Columns give the labels for the points being compared, their distance,
whether genotypes match, and the number of non-NA observations for
each pair. If genotypes
is a list this will return the average number of
matches.
Matches will return NaN if sampling points at some distance
did not contain a plant.
Tom Ellis
positions <- sort(runif(16, -5,5))
# Example with vector
genotypes <- rep(letters[1:4], each=4)
distance_identities(genotypes, positions, labels = LETTERS[1:16])
# Example with list
genotypes <- list(
rep(letters[1:4], each=4),
rep(letters[1:4], 4)
)
distance_identities(genotypes, positions, labels = LETTERS[1:16])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.