Skip to contents

Converts 0-based or 1-based integer cluster IDs (as produced by Seurat's FindClusters) into zero-padded labels with a custom prefix, e.g. cluster 0 → "C01", cluster 1 → "C02".

Usage

RenameClusters(x, prefix = "C", start = 1L)

Arguments

x

A vector of numeric or character cluster IDs (e.g. 0, 1, 2, ...).

prefix

Character prefix to prepend. Default "C".

start

Integer. The output number assigned to the lowest cluster. start = 1 (default) maps cluster 0 → "C01". start = 0 maps cluster 0 → "C00".

Value

A factor with levels in cluster order.

Examples

if (FALSE) { # \dontrun{
SeuratObj$Cluster <- RenameClusters(SeuratObj$seurat_clusters, prefix = "C", start = 1)
# cluster 0 → "C01", cluster 1 → "C02", ...
} # }