dist2: Pairwise squared Euclidean distances

Description Usage Arguments Value Author(s) Examples

View source: R/dist2.R

Description

Computes the squared Euclidean distances between all pairs of data point given

Usage

1
dist2(X, C)

Arguments

X

A data matrix where each row is a different data point

C

A data matrix where each row is a different data point. If this matrix is the same as X, pairwise distances for all data points are computed.

Value

Returns an N x M matrix where N is the number of rows in X and M is the number of rows in M. element (n,m) is the squared Euclidean distance between nth data point in X and mth data point in C

Author(s)

Dr. Anna Goldenberg, Bo Wang, Aziz Mezlini, Feyyaz Demir

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Data1 is of size n x d_1, 
## where n is the number of patients, d_1 is the number of genes, 
## Data2 is of size n x d_2, 
## where n is the number of patients, d_2 is the number of methylation
data(Data1)
data(Data2)

## Calculate distance matrices(here we calculate Euclidean Distance, 
## you can use other distance, e.g. correlation)
Dist1 = dist2(as.matrix(Data1), as.matrix(Data1))
Dist2 = dist2(as.matrix(Data2), as.matrix(Data2))

SNFtool documentation built on June 11, 2021, 9:06 a.m.

Related to dist2 in SNFtool...