gclus (version 1.3.2)

vec2distm: Various utility functions

Description

vec2distm converts a vector to a distance matrix.

vec2dist converts a vector to a dist structure.

lower2upper.tri.inds is the same as lower.to.upper.tri.inds from package cluster. It computes an index vector for extracting or reordering a lower triangular matrix that is stored as a contiguous vectors.

diag.off returns a vector of off-diagonal elements of a matrix. off specifies the distance above the main (0) diagonal.

clus2memship converts a list whose ith element contains the indices of objects in the ith cluster into a vector whose ith element gives the cluster number of the ith object.

memship2clus converts a vector whose ith element gives the cluster number of the ith object into a list whose ith element contains the indices of objects in the ith cluster.

Usage

vec2distm(vec)
vec2dist(vec)
lower2upper.tri.inds(n)
diag.off(m,off=1)
clus2memship(clusters)
memship2clus(memship)

Arguments

vec

is a vector.

n

is an integer > 1.

m

is a matrix.

clusters

is a list whose ith element contains the indices of the objects belonging to the ith cluster.

off

is an integer specifying the distance above the main (0) diagonal.

memship

is a vector whose ith element gives the cluster number of the ith object.

See Also

dist, diag.

Examples

Run this code
# NOT RUN {
vec <- 1:15
vec2distm(vec)
vec2dist(vec)
diag.off(vec2distm(vec))
lower2upper.tri.inds(5)
clus2memship(list(c(1,3,5),c(2,6),4))
memship2clus(c(1,3,4,2,1,4,2,3,2,3))
# }

Run the code above in your browser using DataCamp Workspace