CustomDistance: Run a custom distance function on an input data matrix

Description Usage Arguments Value Author(s) Examples

View source: R/utilities.R

Description

Run a custom distance function on an input data matrix

Usage

1
CustomDistance(my.mat, my.function, ...)

Arguments

my.mat

A matrix to calculate distance on

my.function

A function to calculate distance

...

Extra parameters to my.function

Value

A distance matrix

Author(s)

Jean Fan

Examples

1
2
3
4
5
# Define custom distance matrix
manhattan.distance <- function(x, y) return(sum(abs(x-y)))

input.data <- GetAssayData(pbmc_small, assay.type = "RNA", slot = "scale.data")
cell.manhattan.dist <- CustomDistance(input.data, manhattan.distance)

Seurat documentation built on Jan. 13, 2021, 7:11 p.m.