library(lattice)
library(grid)
if(interactive())
old.prompt <- grid::grid.prompt(TRUE)
applications <- aggregate(percent(Dept,weight=Freq,ci=TRUE)~Gender,
data=UCBAdmissions)
admissions <- aggregate(
percent(Admit=="Admitted",weight=Freq,ci=TRUE)~Dept+Gender,
data=UCBAdmissions)
xyplot(cbind(Percentage,lower,upper)~Gender|Dept,data=admissions,
panel=panel.errbars,
ewidth=.2,pch=19,
ylab="Percentage applicants admitted by Department")
xyplot(cbind(Percentage,lower,upper)~Gender|Dept,data=applications,
panel=panel.errbars,
ewidth=.2,pch=19,
ylab="Percentage applications to the Department")
if(interactive())
grid::grid.prompt(old.prompt)
Run the code above in your browser using DataLab