Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

expand

Expand a Table in a Data Frame


Description

This function takes a multi-dimensionnal contingency table and expands it to a data frame containing individual records.

Usage

expand(x, ...)

## S3 method for class 'table'
expand(x, ...)

Arguments

x

An object of type table storing a N-dimensial contingency table.

...

Further arguments passed to or from other methods.

Value

A data frame of the individual records derived from x.

Note

The function is inspired from the "Cookbook for R".

It should also be noted that the cells od x are rounded before being expanded in a data frame.

Author(s)

Johan Barthelemy.

Maintainer: Johan Barthelemy johan@uow.edu.au.

References

See Also

Examples

# loading data
data(spnamur, package = "mipfp")
# subsetting the data frame, keeping only the first 3 variables
spnamur.sub <- subset(spnamur, select = Household.type:Prof.status)
# create a contingency table
t <- table(spnamur.sub)
# expand the table to a data frame
t.df <- expand(t)

mipfp

Multidimensional Iterative Proportional Fitting and Alternative Models

v3.2.1
GPL-2
Authors
Johan Barthelemy [aut, cre], Thomas Suesse [aut], Mohammad Namazi-Rad [ctb]
Initial release
2018-08-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.