Learn R Programming

hypercube (version 0.2.1)

as.data.frame.Cube: Converts the actual view of a cube to a data frame

Description

Converts the actual view of a Cube object to a data frame. All added selections and aggregations will be regarded. Note that selection criteria will be applied before aggregating the data.

Usage

# S3 method for Cube
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

The Cube object that will be converted to a data frame.

row.names

A character vector giving the row names for the data frame.

optional

Should setting row names and converting column names be optional?

...

Further parameters that are passed to as.data.frame.table.

Value

A molten data frame

See Also

add.aggregation add.selection

Examples

Run this code
# NOT RUN {
data("sales")
cube = generateCube(sales, columns = list(time = c("month", "year"),
      location = c("state"), product = "product"), valueColumn = "amount")
cube = change.dimensionOrder(cube, dimensions = c("product", "month", "year", "state"))
df = as.data.frame(cube)
df

# }

Run the code above in your browser using DataLab