sim_annotate: Annotate a melted similarity matrix.

View source: R/sim_annotate.R

sim_annotateR Documentation

Annotate a melted similarity matrix.

Description

sim_annotate annotates a melted similarity matrix.

Usage

sim_annotate(
  sim_df,
  row_metadata,
  annotation_cols,
  index = "both",
  sim_cols = c("id1", "id2", "sim")
)

Arguments

sim_df

data.frame with melted similarity matrix.

row_metadata

data.frame with row metadata.

annotation_cols

character vector specifying annotation columns.

index

optional character string specifying whether to annotate left index, right index, or both. This must be one of the strings "both" (default), "left", "right".

sim_cols

optional character string specifying minimal set of columns for a similarity matrix

Value

Annotated melted similarity matrix of the same class as sim_df.

Examples

suppressMessages(suppressWarnings(library(magrittr)))
population <- tibble::tibble(
  Metadata_group = sample(c("a", "b"), 4, replace = TRUE),
  Metadata_type = sample(c("x", "y"), 4, replace = TRUE),
  x = rnorm(4),
  y = x + rnorm(4) / 100,
  z = y + rnorm(4) / 1000
)
annotation_cols <- c("Metadata_group")
sim_df <- matric::sim_calculate(population, method = "pearson")
row_metadata <- attr(sim_df, "row_metadata")
matric::sim_annotate(sim_df, row_metadata, annotation_cols)

matric documentation built on April 1, 2023, 12:19 a.m.