reorder_factor: Reorder factors of one annotation to match another

View source: R/human_functions.R

reorder_factorR Documentation

Reorder factors of one annotation to match another

Description

This function takes two identical annotations (e.g, two cluster calls for the same cells) and updates the levels of the match cluster to correspond to the levels of the reference cluster. This is useful to run prior to 'compare_plot' if clusters are not already ordered.

'clRef' and 'clMatch' should be factors, but can be coerced from characters if needed.

Usage

reorder_factor(clMatch, clRef)

Arguments

clMatch

A cluster factor object to compare to a reference

clRef

A cluster factor object for the reference clusters

Value

The 'clMatch' vector with levels rearranged to match 'clRef' in a reasonable way.


AllenInstitute/scrattch.hicat documentation built on Oct. 20, 2023, 6:55 a.m.