one function a day: multiway tables with ftable | Swimming the Data Lake

# one function a day: multiway tables with ftable

## 2019/19/05

it´s usual to make confusion tables or cross tables when we have vectors of same lenght to compute and cross classify them, but some other issues arise when we have several dimensions (more than two).

Since this is a common situation but it´s not so common to know the easy solution, so here comes ftable function from package stats.

Let´s use Titanic dataset for an example:

data(Titanic)
ftable(Titanic)

Survived  No Yes
Class Sex    Age
1st   Male   Child            0   5
Female Child            0   1
2nd   Male   Child            0  11
Female Child            0  13
3rd   Male   Child           35  13
Female Child           17  14
Crew  Male   Child            0   0