sDistance: Function to compute the pairwise distance for a given data...

Description Usage Arguments Value Note See Also Examples

View source: R/sDistance.r

Description

sDistance is supposed to compute and return the distance matrix between the rows of a data matrix using a specified distance metric

Usage

1
2
3
4
5
6
sDistance(
data,
metric = c("pearson", "spearman", "kendall", "euclidean", "manhattan",
"cos", "mi",
"binary")
)

Arguments

data

a data frame or matrix of input data

metric

distance metric used to calculate a symmetric distance matrix. See 'Note' below for options available

Value

Note

The distance metrics are supported:

See Also

sDmatCluster

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# 1) generate an iid normal random matrix of 100x10 
data <- matrix( rnorm(100*10,mean=0,sd=1), nrow=100, ncol=10)

# 2) calculate distance matrix using different metric
sMap <- sPipeline(data=data)
# 2a) using "pearson" metric
dist <- sDistance(data=data, metric="pearson")
# 2b) using "cos" metric
# dist <- sDistance(data=data, metric="cos")
# 2c) using "spearman" metric
# dist <- sDistance(data=data, metric="spearman")
# 2d) using "kendall" metric
# dist <- sDistance(data=data, metric="kendall")
# 2e) using "euclidean" metric
# dist <- sDistance(data=data, metric="euclidean")
# 2f) using "manhattan" metric
# dist <- sDistance(data=data, metric="manhattan")
# 2g) using "mi" metric
# dist <- sDistance(data=data, metric="mi")
# 2h) using "binary" metric
# dist <- sDistance(data=data, metric="binary")

supraHex documentation built on Nov. 26, 2020, 2:01 a.m.