Add cell metadata
add_cell_metadata.RdAdd cell metadata
Usage
# S3 method for class 'MarchRDataset'
add_cell_metadata(proj, metadata, overwrite = FALSE)
# S3 method for class 'MarchRProject'
add_cell_metadata(
proj,
metadata,
dataset_name = character(0),
overwrite = FALSE
)
# S3 method for class 'MarchRDataset'
add_cell_metadata_col(proj, values, col_name, overwrite = FALSE)
# S3 method for class 'MarchRProject'
add_cell_metadata_col(
proj,
values,
col_name,
dataset_name = character(0),
overwrite = FALSE
)Arguments
- proj
(MarchRDataset or MarchRProject) Object to add metadata to.
- metadata
(data.frame; matrix) Metadata to add, with one row per metadata entry and one column per cell.
- overwrite
(logical) If TRUE, overwrite existing metadata with the same name.
- dataset_name
(character) Name of the dataset to add metadata column to. If not given, all datasets are used.
- values
(vector) Values to add as a new metadata column, with names set as cell names. If names are not set, values will be matched to cells by order. If the names are not set and the length of values does not match the number of cells, an error will be thrown.
- col_name
(character) Name of the metadata column to add.
- ...
Additional arguments passed to specific methods.
Details
This function adds metadata to a dataset or project. The ordering of the metadata columns must match the cell names in the dataset. If only some cells are given in the metadata, the remaining cells will be filled with 'NA', if they exist in the dataset. Cells must be aligned across matrices and fragments.
If adding metadata to multiple datasets, the metadata will be split by dataset based on cell names. This requires that cell names are unique across datasets.