Sorry for the confusing first post. I have edited for clarity and included some sample data.
Clarified summary of problem: I have an Excel spreadsheet has a row for every student registered at the university for each term since fall 2010 with the following information about each student in columns: Term, Campus, College, Major, Gender, Ethnicity, Age.
My goal is to be able to generate a print ready report out of R that will build some output quality tables for printing. I don't care if they are PDF, HTML, etc., as long as I can print them and they are somewhat attractive. So far, I have imported the spreadsheet into R as a CSV I have been attempting to do this with the "GridExtra" library with some success.
I have 3 problems thus far: 1. If the count for a cell in the table is zero, it does not appear in the table; 2. I am unable to understand how to create more complex tables: for example a table that; 3. I am not able to create a column and row total.
An example table is shown below:
------Campus S-------|---------Campus M-----|-----Campus O------
2010 2011 2012 2010 2011 2012 2010 2011 2012 Total column
COE
A
B
C
COBA
A
B
C
Totals -->
Thus far my efforts have been something like this (small sample dataset):
Term <- c("Fall 2010", "Fall 2010", "Fall 2011", "Fall 2011", "Fall 2011", "Fall 2011", "Fall 2010",
"Fall 2010", "Fall 2011", "Fall 2011", "Fall 2011", "Fall 2011")
Campus <- c("S", "M", "O", "O", "S", "S", "O", "S", "S", "O", "S", "S")
College <- c("COE", "COBA", "COBA", "COLFA", "COE", "COBA", "COBA", "COBA", "COBA", "COBA", "COBA", "COLFA")
Major <- c("A", "B", "C", "A", "C", "C", "A", "C", "C", "A", "C", "C")
Gender <- c("M", "F", "F", "F", "F", "M", "F", "F", "M", "F", "F", "M")
Ethnicity <- c("B", "W", "W", "B", "B", "W", "B", "W", "W", "B", "W", "W")
Age <- c(25, 27, 44, 62, 23, 36, 42, 44, 55, 65, 33, 20)
mydata <- data.frame(Term, Campus, College, Major, Gender, Ethnicity, Age)
mydata
termxcamp.table <- table(mydata$Term, mydata$Campus)
termxcoll.table <- table(mydata$Term, mydata$College)
library(gridExtra)
plot.new()
grid.table(termxcamp.table)
plot.new()
grid.table(termxcoll.table)