I have a dataset like this
id | january | february | march | april |
---|---|---|---|---|
1 | scheduled | done | null | done |
2 | scheduled | scheduled | done | |
3 | ongoing | canceled | scheduled |
I desire to transform this dataset in a matrix like this in output, where each cell are the occurrences of the exact intersection (keeping Null Values).
event | january | february | march | april |
---|---|---|---|---|
scheduled | 2 | 1 | 1 | 0 |
done | 0 | 1 | 1 | 1 |
ongoing | 1 | 0 | 0 | 0 |
null | 0 | 0 | 0 | 2 |