# dist.gene

##### Pairwise Distances from Genetic Data

This function computes a matrix of distances between pairs of individuals from a matrix or a data frame of genetic data.

- Keywords
- manip

##### Usage

```
dist.gene(x, method = "pairwise", pairwise.deletion = FALSE,
variance = FALSE)
```

##### Arguments

- x
a matrix or a data frame (will be coerced as a matrix).

- method
a character string specifying the method used to compute the distances; two choices are available:

`"pairwise"`

and`"percentage"`

, or any unambiguous abbreviation of these.- pairwise.deletion
a logical indicating whether to delete the columns with missing data on a pairwise basis. The default is to delete the columns with at least one missing observation.

- variance
a logical, indicates whether the variance of the distances should be returned (default to

`FALSE`

).

##### Details

This function is meant to be very general and accepts different kinds of data (alleles, haplotypes, SNP, DNA sequences, …). The rows of the data matrix represent the individuals, and the columns the loci.

In the case of the pairwise method, the distance \(d\) between two individuals is the number of loci for which they differ, and the associated variance is \(d(L - d)/L\), where \(L\) is the number of loci.

In the case of the percentage method, this distance is divided by \(L\), and the associated variance is \(d(1 - d)/L\).

For more elaborate distances with DNA sequences, see the function
`dist.dna`

.

##### Value

an object of class `dist`

. If `variance = TRUE`

an
attribute called `"variance"`

is given to the returned object.

##### Note

Missing data (`NA`

) are coded and treated in R's usual way.

##### See Also

*Documentation reproduced from package ape, version 4.1, License: GPL (>= 2)*