Here are the first few rows of my table...
In R, how do I create a long table where Col A and Col B show every possible combination and Col C contains either a or b (or c or d or whatever its value might be), and Col D shows the frequency of Col C value for each combination of Col A and B.
Using the example above, the results should look like this (showing just the first few rows)...
I tried combinations of melt() and table() with little success.
Data