# fixdmat: Distance matrix conversion In ecodist: Dissimilarity-Based Functions for Ecological Analysis

## Description

Convert a row-order lower-triangular distance matrix to a full symmetric matrix.

## Usage

 `1` ``` fixdmat(v) ```

## Arguments

 `v` lower-triangular distance matrix in row order.

## Details

R distance functions such as dist and bcdist return a lower triangular distance matrix in column order. Some other programs return the lower triangular matrix in row order. To use this matrix in R functions, it must be converted from row order to column order.

## Value

full symmetric distance matrix.

## Author(s)

Sarah Goslee

`lower`, `full`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```x.vec <- seq_len(6) x.vec # Make an R-style column order symmetric matrix full(x.vec) # Extract the lower triangle from a symmetric matrix # in column order lower(full(x.vec)) # Convert to or from a row order symmetric matrix fixdmat(x.vec) lower(fixdmat(x.vec)) fixdmat(c(1, 2, 4, 3, 5, 6)) ```

### Example output

```[1] 1 2 3 4 5 6
[,1] [,2] [,3] [,4]
[1,]    0    1    2    3
[2,]    1    0    4    5
[3,]    2    4    0    6
[4,]    3    5    6    0
[1] 1 2 3 4 5 6
[,1] [,2] [,3] [,4]
[1,]    0    1    2    4
[2,]    1    0    3    5
[3,]    2    3    0    6
[4,]    4    5    6    0
[1] 1 2 4 3 5 6
[,1] [,2] [,3] [,4]
[1,]    0    1    2    3
[2,]    1    0    4    5
[3,]    2    4    0    6
[4,]    3    5    6    0
```

ecodist documentation built on July 13, 2017, 9:02 a.m.