Read a distance matrix from a file or data frame.

read.dist(data, el1.column = 1, el2.column = 2, dist.columns = 3)

Arguments

data

a filename, data frame or matrix

el1.column

the column name or id specifying the first element

el2.column

the column name or id specifying the second element

dist.columns

the column name(s) or id(s) specifying the distance(s) between the two corresponding elements

Value

a distance matrix (or list of distance matrixes when there is more than one dist.columns) of type matrix

Examples

read.dist(cbind(c(1,1,1,2,2,3), c(2,3,4,3,4,4), 1:6, 6:1), dist.columns=c(3,4))
#> $`3` #> [,1] [,2] [,3] [,4] #> [1,] 0 1 2 3 #> [2,] 0 0 4 5 #> [3,] 0 0 0 6 #> [4,] 0 0 0 0 #> #> $`4` #> [,1] [,2] [,3] [,4] #> [1,] 0 6 5 4 #> [2,] 0 0 3 2 #> [3,] 0 0 0 1 #> [4,] 0 0 0 0 #>