Flatten a table, array or matrix
This function takes a multidimensional object and flattens it for a pretty printing. The row names are the concatenation of the original dimension names while the only column stores the initial data of the object.
## S3 method for class 'array' flat(x, sep = ".", label = "value", l.names = 0, ...) ## S3 method for class 'table' flat(x, sep = ".", label = "value", l.names = 0, ...) ## S3 method for class 'matrix' flat(x, sep = ".", label = "value", l.names = 0, ...)
x |
An array, table or matrix. |
sep |
The separator used to concatenate the dimension names. |
label |
The name of the column storing the data. |
l.names |
If set to a value greater than 0, then the dimnames will be shorten to
a length of |
... |
Not used. |
An array containing a flattened version of x.
The function is inspired from the function wrap.array from the package
R.utils written by Henrik Bengtsson.
Johan Barthelemy.
Maintainer: Johan Barthelemy johan@uow.edu.au.
The function wrap.array from the R.utils package
(https://cran.r-project.org/package=R.utils).
# loading the data and saving in a 3D-table data(spnamur, package = "mipfp") spnamur.sub <- subset(spnamur, select = Household.type:Prof.status) tab <- table(spnamur.sub) # flattening the table tab.flat <- flat(tab) print(tab.flat)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.