ex.data <- expand.grid(mean=c(0,100),sd=c(1,10))[rep(1:4,rep(100,4)),]
ex.data <- transform(ex.data,x=rnorm(n=nrow(ex.data),mean=ex.data$mean,sd=ex.data$sd))
aggregate(~mean+sd,data=ex.data)
aggregate(mean(x)~mean+sd,data=ex.data)
aggregate(mean(x)~mean+sd,data=ex.data,name="Average")
aggregate(c(mean(x),sd(x))~mean+sd,data=ex.data)
aggregate(c(Mean=mean(x),StDev=sd(x),N=length(x))~mean+sd,data=ex.data)
genTable(c(Mean=mean(x),StDev=sd(x),N=length(x))~mean+sd,data=ex.data)
attach(ex.data)
aggregate(c(Mean=mean(x),StDev=sd(x))~mean+sd)
genTable(c(Mean=mean(x),StDev=sd(x))~mean+sd)
detach(ex.data)
aggregate(wtable(Admit,Freq)~.,data=UCBAdmissions)
aggregate(Admit~.,data=UCBAdmissions)
aggregate(percent(Admit)~.,data=UCBAdmissions)
aggregate(percent(Admit)~Gender,data=UCBAdmissions)
aggregate(percent(Admit)~Dept,data=UCBAdmissions)
aggregate(percent(Gender)~Dept,data=UCBAdmissions)
aggregate(percent(Admit)~Dept,data=UCBAdmissions,Gender=="Female")
genTable(percent(Admit)~Dept,data=UCBAdmissions,Gender=="Female")
Run the code above in your browser using DataLab