Description Usage Arguments Details Value Examples

The Bray-Curtis distance is the Manhattan distance divided by the sum of both vectors.

1 | ```
bray_curtis(x, y)
``` |

`x, y` |
Numeric vectors |

For two vectors `x`

and `y`

, the Bray-Curtis distance is defined
as

*d(x, y) = \frac{∑_i |x_i - y_i|}{∑_i x_i + y_i}.*

The Bray-Curtis distance is connected to many other distance measures in this package; we try to list some of the more important connections here. Relation to other definitions:

Equivalent to

`vegdist()`

with`method = "bray"`

.Equivalent to the

`braycurtis()`

function in`scipy.spatial.distance`

for positive vectors. They take the absolute value of*x_i + y_i*in the denominator.Equivalent to the

`braycurtis`

and`odum`

calculators in Mothur.Equivalent to

*D_14 = 1 - S_17*in Legendre & Legendre.The Bray-Curtis distance on proportions is equal to half the Manhattan distance.

The Bray-Curtis distance on presence/absence vectors is equal to the Sorenson index of dissimilarity.

The Bray-Curtis distance between `x`

and `y`

. The
Bray-Curtis distance is undefined if the sum of all elements in `x`

and `y`

is zero, in which case we return `NaN`

.

1 2 3 4 5 6 7 | ```
x <- c(15, 6, 4, 0, 3, 0)
y <- c(10, 2, 0, 1, 1, 0)
bray_curtis(x, y)
# For proportions, equal to half the Manhattan distance
bray_curtis(x / sum(x), y / sum(y))
manhattan(x / sum(x), y / sum(y)) / 2
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.