Split an Assay

# S3 method for Assay5
  drop = FALSE,
  layers = c("counts", "data"),
  ret = c("assay", "multiassays", "layers"),



An Assay5 object


a ‘factor’ in the sense that as.factor(f) defines the grouping, or a list of such factors in which case their interaction is used for the grouping. If x is a data frame, f can also be a formula of the form ~ g to split by the variable g, or more generally of the form ~ g1 + ... + gk to split by the interaction of the variables g1, ..., gk, where these variables are evaluated in the data frame x using the usual non-standard evaluation rules.


logical indicating if levels that do not occur should be dropped (if f is a factor or a list).


Names of layers to include in the split; pass NA for all layers; pass NULL for the default layer


Type of return value; choose from:

  • assay”: a single Assay5 object

  • multiassay”: a list of Assay5 objects

  • layers”: a list of layer matrices




Depends on the value of ret:

  • assay”: x with the layers requested in layers split based on f; all other layers are left as-is

  • multiassay”: a list of Assay5 objects; the list contains one value per split and each assay contains only the layers requested in layers with the key set to the split

  • layers”: a list of matrices of length length(assays) * length(unique(f)); the list is named as “layer.split

Progress Updates with progressr

This function uses progressr to render status updates and progress bars. To enable progress updates, wrap the function call in with_progress or run handlers(global = TRUE) before running this function. For more details about progressr, please read vignette("progressr-intro")

See also

v5 Assay object, validity, and interaction methods: $.Assay5(), Assay5-class, Assay5-validity, [.Assay5(), [[.Assay5(), dim.Assay5(), dimnames.Assay5(), merge.Assay5(), subset.Assay5()