Learn R Programming

reshape (version 0.8.9)

melt.array: Melt an array

Description

This function melts a high-dimensional array into a form that you can use cast with.

Usage

# S3 method for array
melt(data, varnames = names(dimnames(data)), ...)

Arguments

data

array to melt

varnames

variable names to use in molten data.frame

...

other arguments ignored

Details

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

Examples

Run this code
# NOT RUN {
a <- array(1:24, c(2,3,4))
melt(a)
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)
# }

Run the code above in your browser using DataLab