flatten {humanleague}R Documentation

Convert multidimensional array of counts per state into table form. Each row in the table corresponds to one individual

Description

This function

Usage

flatten(stateOccupancies, categoryNames)

Arguments

stateOccupancies

an arbitrary-dimension array of (integer) state occupation counts.

categoryNames

a string vector of unique column names.

Value

a DataFrame with columns corresponding to category values and rows corresponding to individuals.

Examples

gender=c(51,49)
age=c(17,27,35,21)
states=qis(list(1,2),list(gender,age))$result
table=flatten(states,c("Gender","Age"))
print(nrow(table[table$Gender==1,])) # 51
print(nrow(table[table$Age==2,])) # 27

[Package humanleague version 2.3.1 Index]