bc_meta: Accesses and sets metadata in BarcodeObj object

bc_metaR Documentation

Accesses and sets metadata in BarcodeObj object

Description

Sample information is kept in metadata. bc_meta is for accessing and updating metadata in BarcodeObj object

Usage

bc_meta(barcodeObj)

bc_meta(barcodeObj, key = NULL) <- value

## S4 method for signature 'BarcodeObj'
bc_meta(barcodeObj)

## S4 replacement method for signature 'BarcodeObj'
bc_meta(barcodeObj, key = NULL) <- value

Arguments

barcodeObj

A BarcodeObj object.

key

A string, identifying the metadata record name to be modified.

value

A string vector or a data.frame. If the value is a vector, it should have the same length of sample number in the BarcodeObj object. Otherwise, if the value is data.frame, the row name of the data.frame should be the sample name, and each column as a metadata variable.

Value

A data.frame

Examples

data(bc_obj)

# get the metadata data.frame
bc_meta(bc_obj)

# assign value to metadata by $ operation
bc_meta(bc_obj)$phenotype <- c("l", "b")

# assign value to metadata by "key" argument
bc_meta(bc_obj, key = "sample_type") <- c("l", "b")

# show the updated metadata
bc_meta(bc_obj)

# assign new data.frame to metadata
metadata <- data.frame(
    sample_name <- c("test1", "test2"),
    phenotype <- c("l", "b")
    )
rownames(metadata) = bc_names(bc_obj)
bc_meta(bc_obj) <- metadata
###

wenjie1991/CellBarcode documentation built on Aug. 10, 2024, 11:02 a.m.