melt.array {reshape2}R Documentation

Melt an array.

Description

This code is conceptually similar to as.data.frame.table

Usage

  ## S3 method for class 'array'
 melt(data,
    varnames = names(dimnames(data)), ..., na.rm = FALSE,
    value.name = "value")

Arguments

data

array to melt

varnames

variable names to use in molten data.frame

...

further arguments passed to or from other methods.

value.name

name of variable used to store values

na.rm

Should NA values be removed from the data set? This will convert explicit missings to implicit missings.

Examples

a <- array(c(1:23, NA), c(2,3,4))
melt(a)
melt(a, na.rm = TRUE)
melt(a, varnames=c("X","Y","Z"))
dimnames(a) <- lapply(dim(a), function(x) LETTERS[1:x])
melt(a)
melt(a, varnames=c("X","Y","Z"))
dimnames(a)[1] <- list(NULL)
melt(a)

[Package reshape2 version 1.2.2 Index]