I have a dataframe variable myDF
that looks like this:
A B
0 1
0 1
0 1
0 1
If I run xtabs(data=myDF)
I get a 1 X 1 matrix that shows that factor B=1 exactly 4 times and A=0 exactly 4 times.
I would like to get a 2X2 matrix that also indicates that B=0 and A=0 exactly 0 times etc.
I have been looking at the docs and am not sure how this is done. How do I specify that I should include missing levels? I am comfortable with python but pretty new to R.