I find myself recreating nested frequency tables over and over again from articles using matrix and recreating tables (or sometimes giving up and using rep and making the full data set which is very time consuming. I’m looking for the fastest way (least code) to recreate this nested frequency table in R (I assume this is a question that many can benefit from).
gender female male
hs.grad race
no asian 3 4
black 5 10
white 17 11
yes asian 5 7
black 1 9
white 11 17
This was created using ftable if that’s helpful.
Thank you in advance.
Do you mean something like this?
Or