Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pairDist

Pairwise distance plots


Description

The function pairDistPlot extracts and plots pairwise distances between different groups (graphs use ggplot2). The function pairDistPlot does the same, without the graphs.

pairDistPlot is a generic function with methods for the following types of objects:
- dist
- matrix (only numeric data)
- genind objects (genetic markers, individuals)
- DNAbin objects (DNA sequences)

Usage

pairDist(x, ...)

pairDistPlot(x, ...)

## S3 method for class 'dist'
pairDistPlot(x, grp, within=FALSE, sep="-", data=TRUE,
             violin=TRUE, boxplot=TRUE, jitter=TRUE, ...)

## S3 method for class 'matrix'
pairDistPlot(x, grp, within=FALSE, sep="-", data=TRUE,
             violin=TRUE, boxplot=TRUE, jitter=TRUE, ...)

## S3 method for class 'genind'
pairDistPlot(x, grp, within=FALSE, sep="-", data=TRUE,
             violin=TRUE, boxplot=TRUE, jitter=TRUE, ...)

## S3 method for class 'DNAbin'
pairDistPlot(x, grp, within=FALSE, sep="-", data=TRUE,
             violin=TRUE, boxplot=TRUE, jitter=TRUE, ...)

Arguments

x

pairwise distances provided as a dist or a symmetric matrix, or genind or DNAbin object. For genind objects, pairwise squared Euclidean distances are computed from the allele data. For DNAbin objects, distances are computed uing dist.dna, and '...' is used to pass arguments to the function.

grp

a factor defining a grouping of individuals.

within

a logical indicating whether to keep within-group comparisons.

sep

a character used as separator between group names

data

a logical indicating whether data of the plot should be returned.

violin

a logical indicating whether a violinplot should be generated.

boxplot

a logical indicating whether a boxplot should be generated.

jitter

a logical indicating whether a jitter-plot should be generated.

...

further arguments to be used by other functions; used for DNAbin object to pass argumetns to dist.dna.

Value

A list with different components, depending on the values of the arguments. Plots are returned as ggplot2 objects.

Author(s)

Thibaut Jombart t.jombart@imperial.ac.uk.

See Also

gengraph to identify connectivity based on distances.

Examples

## Not run: 

## use a subset of influenza data
data(H3N2)
set.seed(1)
dat <- H3N2[sample(1:nInd(H3N2), 100)]

## get pairwise distances
temp <- pairDistPlot(dat, other(dat)$epid)

## see raw data
head(temp$data)

## see plots
temp$boxplot
temp$violin
temp$jitter


## End(Not run)

adegenet

Exploratory Analysis of Genetic and Genomic Data

v2.1.3
GPL (>= 2)
Authors
Thibaut Jombart [aut] (<https://orcid.org/0000-0003-2226-8692>), Zhian N. Kamvar [aut, cre] (<https://orcid.org/0000-0003-1458-7108>), Caitlin Collins [ctb], Roman Lustrik [ctb], Marie-Pauline Beugin [ctb], Brian J. Knaus [ctb], Peter Solymos [ctb], Vladimir Mikryukov [ctb], Klaus Schliep [ctb], Tiago Maié [ctb], Libor Morkovsky [ctb], Ismail Ahmed [ctb], Anne Cori [ctb], Federico Calboli [ctb], RJ Ewing [ctb], Frédéric Michaud [ctb], Rebecca DeCamp [ctb], Alexandre Courtiol [ctb] (<https://orcid.org/0000-0003-0637-2959>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.