full: Full symmetric matrix

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/full.R

Description

Convert a column order distance matrix to a full symmetric matrix.

Usage

1
  full(v)

Arguments

v

lower-triangular column order distance matrix.

Details

Converts a column order lower-triangular distance matrix as written by R functions into a symmetric matrix. Note that lower() used on a 1x1 matrix will return the single element, which may not be the correct behavior in all cases, while full() used on a single element will return a 2x2 matrix.

Value

full symmetric matrix.

Author(s)

Sarah Goslee

See Also

lower, fixdmat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Given a vector:
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))

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