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 'Matrix'
melt(
  object,
  colnames = c("rowname", "colname", "value"),
  min = -Inf,
  minMethod = c("absolute", "perRow"),
  trans = c("identity", "log2", "log10")
)

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

Arguments

object

Object.

colnames

character(3). Column name mappings for melted data frame return.

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).

assay

vector(1). Assay name or index position.

...

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(RangedSummarizedExperiment, package = "AcidTest")

## SummarizedExperiment ====
object <- RangedSummarizedExperiment
dim(object)
x <- melt(object)
nrow(x)
print(x)

acidgenomics/r-acidexperiment documentation built on Jan. 17, 2024, 7:56 p.m.