| distances | R Documentation |
Specify either a symmetric distance matrix or the file from which to read the matrix. See https://www.corehunter.org for documentation and examples of the distance matrix file format used by Core Hunter.
distances(data, file)
data |
Symmetric distance matrix. Unique row and column headers are required,
should be the same and are used as item ids. Can be a |
file |
File from which to read the distance matrix. |
Distance matrix data of class chdist with elements
dataDistance matrix (numeric matrix).
sizeNumber of individuals in the dataset.
idsUnique item identifiers.
namesItem names. Names of individuals to which no explicit name
has been assigned are equal to the unique ids.
javaJava version of the data object.
fileNormalized path of file from which data was read (if applicable).
# create from distance matrix
m <- matrix(runif(100), nrow = 10, ncol = 10)
diag(m) <- 0
# make symmetric
m[lower.tri(m)] <- t(m)[lower.tri(m)]
# set headers
rownames(m) <- colnames(m) <- paste("i", 1:10, sep = "-")
dist <- distances(m)
# read from file
dist.file <- system.file("extdata", "distances.csv", package = "corehunter")
dist <- distances(file = dist.file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.