Learn R Programming

colorrepel (version 0.4.3)

calc_distance: Distance calculations for spatial coord

Description

Distance calculations for spatial coord

Usage

calc_distance(
  coord,
  metadata,
  cluster_col = "cluster",
  collapse_to_cluster = FALSE
)

Value

min distance matrix

Arguments

coord

dataframe or matrix of spatial coordinates, cell barcode as rownames

metadata

data.frame or vector containing cluster assignments per cell. Order must match column order in supplied matrix. If a data.frame provide the cluster_col parameters.

cluster_col

column in metadata with cluster number

collapse_to_cluster

instead of reporting min distance to cluster per cell, summarize to cluster level