\begin{Schunk}
\begin{Sinput}
 opar <- par(no.readonly = TRUE)
 newmar <- par("mar") + c(3, 0,0,0)
 par(mar = newmar)
 ##From the 2010 midterm notes
 dat$partyid[dat$partyid %in% levels(dat$partyid)[8]] <- NA 
 dat$partyid <- factor(dat$partyid)
 levels(dat$partyid) <- c("Strong Dem.","Dem.","Ind Near Dem", "Independent","Ind. Near Repub.", "Repub.","Strong Repub.")
 dat$pres04[dat$pres04 %in% levels(dat$pres04)[3:10]]<-NA 
 dat$pres04 <- factor(dat$pres04) 
 t1 <- with(dat, prop.table(table(pres04, partyid),2)) 
 barplot(t1,beside=T, las=2, ylim=c(0,1)) 
 abline(h=seq(0.05,1,by=0.05), lty=4, lwd=0.2) 
 legend("top", legend=c("J.Kerry","G.W.Bush"), fill=gray.colors(2), bg="white")
 par <- opar
\end{Sinput}
\end{Schunk}
