Skip to contents

Get slot names and add or remove slots

Usage

Slots(data)

DropSlot(data, pattern = NULL)

AddSlot(data, name, matrix, set.to.default = FALSE, warn = TRUE)

Arguments

data

A grandR object

pattern

a regular expression matched against slot names

name

the slot name

matrix

the data matrix for the new slot

set.to.default

set the new slot as the default slot?

warn

issue a warning if the slot name already exists and is overwritten

Value

Either the slot names or a grandR data with added/removed slots

Functions

  • Slots(): Obtain the slot names

  • DropSlot(): Remove one or several slots from this grandR object

  • AddSlot(): Add an additional slot to this grandR object

See also

Examples

sars <- ReadGRAND(system.file("extdata", "sars.tsv.gz", package = "grandR"),
                  design=c("Cell",Design$dur.4sU,Design$Replicate))
#> Warning: Duplicate gene symbols (n=1, e.g. MATR3) present, making unique!

sars <- Normalize(sars)     # default behavior is to update the default slot
sars
#> grandR:
#> Read from /opt/R/4.2.1/lib/R/library/grandR/extdata/sars
#> 1045 genes, 12 samples/cells
#> Available data slots: count,ntr,alpha,beta,norm
#> Available analyses: 
#> Available plots: 
#> Default data slot: norm
sars <- DropSlot(sars,"norm")
sars                        # note that the defauls slot reverted to count
#> grandR:
#> Read from /opt/R/4.2.1/lib/R/library/grandR/extdata/sars
#> 1045 genes, 12 samples/cells
#> Available data slots: count,ntr,alpha,beta
#> Available analyses: 
#> Available plots: 
#> Default data slot: count