append_colData: Appends colData in an scMethrix object

Description Usage Arguments Details Value Examples

View source: R/scMethrix_clustering.R

Description

Appends colData in an scMethrix object

Usage

1
append_colData(scm = NULL, colData = NULL, name = "Data")

Arguments

scm

scMethrix; Input scMethrix object

colData

dataframe-like or named vector; For a dataframe-like, must contain row names that correspond with the input scMethrix object. For a named vector, vector names must correspond to the row names of the input scMethrix object

name

string; the name of the column for named vector input. Ignored for matrix input

Details

Typically used for clustering. Allows additional information to be added to colData in an scMethrix object after the object creation. It does this via a left join on the original colData. Any samples not included in the colData object will be filled with NAs.

Value

An scMethrix object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# For dataframe-like input
data('scMethrix_data')
colData <- colData(scMethrix_data)
colData["Cluster"] <- 1:nrow(colData)
scMethrix_data <- append_colData(scMethrix_data,colData)
colData(scMethrix_data)

# For named vector input
data('scMethrix_data')
colData <- c(C1=1,C2=1,C3=1,C4=2)
scMethrix_data <- append_colData(scMethrix_data,colData, name="Cluster")
colData(scMethrix_data)

CompEpigen/scMethrix documentation built on Nov. 6, 2021, 3:09 p.m.