as_df {sparta}R Documentation

As data frame

Description

Turn a sparse table into a data frame

Usage

as_df(x, dense = FALSE)

## S3 method for class 'sparta'
as_df(x, dense = FALSE)

Arguments

x

sparta object

dense

Logical indicating if zero cells should be present or not

Value

A data frame

See Also

as_array

Examples

x <- array(
  c(1,0,0,2,3,4,0,0),
  dim = c(2,2,2),
  dimnames = list(
    a = c("a1", "a2"),
    b = c("b1", "b2"),
    c = c("c1", "c2")
  )
)

as_df(as_sparta(x))

[Package sparta version 0.8.4 Index]