assign_analyte_id: Assign analyte ID

assign_analyte_idR Documentation

Assign analyte ID

Description

Replace internal cluster IDs with informative analyte IDs

Usage

assign_analyte_id(
  df,
  .parameter,
  .analyte_id,
  .column_name,
  .cluster_column_name = paste0("cluster_", .column_name),
  .desc = FALSE,
  .data = NULL
)

Arguments

df

The tidy data.frame, with indication of clusters

.parameter

The parameter to order the cluster centers by

.analyte_id

A character vector giving the name of the clusters. The order is important and must match the expected order of clusters.

.column_name

A character giving the name of the column to hold the analyte ID. If the column exists it will be silently dropped.

.cluster_column_name

A character giving the name of the column where the clusters are identified. Will be dropped from the data.frame.

.desc

A boolean giving whether the sort order is descending.

.data

Deprecated. Use df.

Value

A data.frame with cluster names instead of cluster ids.

Examples

## Not run: 
library(beadplexr)
library(ggplot2)

data("lplex")

df <- lplex[[1]] |>
  bp_clara(.parameter = c("FSC-A", "SSC-A"), .column_name = "analyte", .k = 2)

df |>
  beadplexr:::assign_analyte_id(.parameter = c("FSC-A", "SSC-A"),
                                   .analyte_id = c("A", "B"),
                                   .column_name = "pop name",
                                   .cluster_column_name = "analyte") |>
  ggplot() +
  aes(x = `FSC-A`, y = `SSC-A`, colour = `pop name`) +
  geom_point()

df |>
  beadplexr:::assign_analyte_id(.parameter = c("FSC-A", "SSC-A"),
                                   .analyte_id = c("A", "B"),
                                   .column_name = "pop name",
                                   .cluster_column_name = "analyte", .desc = TRUE) |>
  ggplot() +
  aes(x = `FSC-A`, y = `SSC-A`, colour = `pop name`) +
  geom_point()

## End(Not run)


beadplexr documentation built on July 9, 2023, 5:59 p.m.