Skip to content
Advertisement

Convert multiple binary columns into crosstab

I am trying to convert the following dataset which has multiple binary variables into a crosstab.

JavaScript

into the following crosstab but i am having no luck

emotion blue green red
happy 2 2 2
angry 1 2 1
sad 1 1 0

Advertisement

Answer

This is matix multiplication:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement