melt: Melt data from wide to long format

meltR Documentation

Melt data from wide to long format

Description

Unpivot column data from wide format to long format.

Usage

melt(object, ...)

## S4 method for signature 'SingleCellExperiment'
melt(
  object,
  assay = 1L,
  min = -Inf,
  minMethod = c("absolute", "perRow"),
  trans = c("identity", "log2", "log10")
)

Arguments

object

Object.

assay

vector(1). Assay name or index position.

min

numeric(1) or NULL. Minimum count threshold to apply. Filters using "greater than or equal to" logic internally. Note that this threshold gets applied prior to logarithmic transformation, when trans argument applies. Use -Inf or NULL to disable.

minMethod

character(1). Only applies when min argument is numeric. Uses match.arg().

  • absolute: Applies hard cutoff to counts column after the melt operation. This applies to all counts, not per feature.

  • perRow: Applies cutoff per row (i.e. gene). Internally, rowSums() values are checked against this cutoff threshold prior to the melt operation.

trans

character(1). Apply a log transformation (e.g. log2(x + 1L)) to the count matrix prior to melting, if desired. Use "identity" to return unmodified (default).

...

Additional arguments.

Value

DataFrame.

Note

Updated 2023-10-27.

See Also

  • https://seananderson.ca/2013/10/19/reshape/

  • reshape2::melt (deprecated).

  • tidyr::pivot_longer.

  • Python pandas.melt.

Examples

data(SingleCellExperiment_splatter, package = "AcidTest")

## SingleCellExperiment ====
object <- SingleCellExperiment_splatter
dim(object)
df <- melt(object)
nrow(df)
print(df)

acidgenomics/r-acidsinglecell documentation built on March 30, 2024, 5:39 a.m.