bc_meta: Accesses and sets metadata in BarcodeObj object

Description Usage Arguments Value Examples

Description

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

Usage

1
2
3
4
5
6
7
8
9
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data(bc_obj)

# get the metadata data.frame
bc_meta(bc_obj)

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

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

# show the updated metadata
bc_meta(bc_obj)

# assign a 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/CellBarocde documentation built on Dec. 23, 2021, 5:11 p.m.