unxtab: Uncrosstab

View source: R/unxtab.R

unxtabR Documentation

Uncrosstab

Description

Convert a table from crosstab format to long format.

Usage

unxtab(x, labels = c("Year", "Age", "Value"))

Arguments

x

a crosstab table (data frame, matrix, or table) with descriptive row names and column names.

labels

a vector of three strings, used as column names for the resulting data frame.

Value

Data frame in long format (3 columns) that can be crosstabbed to look like x.

Note

Use dimnames like "1990" instead of "Year1990" to end up with numeric entries in resulting data frame.

Another approach is as.data.frame(as.table(as.matrix(x))).


arnima-github/arni documentation built on Oct. 28, 2023, 6:18 p.m.