distancematrix is applied to a matrix of data to
compute the pair wise distances between all rows of the matrix. In
hopach versions >= 2.0.0 these distance functions are calculated in C,
rather than R, to improve run time performance.
function distancevector is applied to a matrix and a vector
to compute the pair wise distances between each row of the matrix and 
the vector. Both functions allow different choices of distance metric.
The functions dissmatrix and dissvector allow one to 
convert between a distance matrix and a vector of the upper triangle. The 
function vectmatrix is used internally.
distancematrix(X, d, na.rm=TRUE)
distancevector(X, y, d, na.rm=TRUE)
dissmatrix(v)
dissvector(M)
vectmatrix(index, p)dissvector.distancematrix, a hdist 
	object of of all pair wise distances between the rows of the data matrix 'X',
	i.e. the value of hdist[i,j] is the distance between rows 'i' and 'j'
	of 'X', as defined by 'd'.  A hdist object is an S4 class containing 
	four slots:
	distancematrix.	as.matrix(hdist).
	(See hdist for more details.)For distancevector, a vector of all pair wise distances between
	rows of 'X' and the vector 'y'. Entry 'j' is the distance between row 'j'
	of 'X' and the vector 'y'.For distancevector, a vector of all pair wise distances between
	rows of 'X' and the vector 'y'. Entry 'j' is the distance between row 'j'
	of 'X' and the vector 'y'.For dissmatrix, the corresponding distance vector. For 
	dissvector, the corresponding distance matrix. If 'M' has
	'p' rows (and columns), then 'v' is length 'p*(p-1)/2'.For vectmatrix, the indices of the row and column of a distance
	matrix corresponding to entry index in the corresponding 
	distance vector.
cor function, and will therefore fail if there are missing values in the data and na.rm!=TRUE.d="cosangle", d="abscosangle", 
d="cor", and d="abscor". Typically, this transformation makes
the dissimilarity correspond more closely with the norm. In order to 
agree with the dist function, the square root is no longer used 
in versions >=2.0.0. 
2.0.0,>van der Laan, M.J. and Pollard, K.S. A new algorithm for hybrid hierarchical clustering with visualization and the bootstrap. Journal of Statistical Planning and Inference, 2003, 117, pp. 275-303.
http://www.stat.berkeley.edu/~laan/Research/Research_subpages/Papers/hopach.pdf
hopach, correlationordering, disscosanglemydata<-matrix(rnorm(50),nrow=10)
deuclid<-distancematrix(mydata,d="euclid")
# old method vdeuclid<-dissvector(deuclid)
vdeuclid<-deuclid@Data
ddaisy<-daisy(mydata)
vdeuclid
ddaisy/sqrt(length(mydata[1,]))
d1<-distancematrix(mydata,d="abscosangle")
d2<-distancevector(mydata,mydata[1,],d="abscosangle")
d1[1,]
d2 #equal to d1[1,]
# old method d3<-dissvector(d1)
d3<-d1@Data
pair<-vectmatrix(5,10)
d1[pair[1],pair[2]]
d3[5]
Run the code above in your browser using DataLab