calc_distance | R Documentation |
Distance calculations for spatial coord
calc_distance(
coord,
metadata,
cluster_col = "cluster",
collapse_to_cluster = FALSE
)
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 |
min distance matrix
cbs <- paste0("cb_", 1:100)
spatial_coords <- data.frame(
row.names = cbs,
X = runif(100),
Y = runif(100)
)
group_ids <- sample(c("A", "B"), 100, replace = TRUE)
dist_res <- calc_distance(
spatial_coords,
group_ids
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.