data(sat.act)
describeBy(sat.act,sat.act$gender) #just one grouping variable
describeBy(sat.act ~ gender) #describe the entire set formula input
describeBy(SATV + SATQ ~ gender,data =sat.act) #specify the data set if using formula
#describeBy(sat.act,list(sat.act$gender,sat.act$education)) #two grouping variables
describeBy(sat.act ~ gender + education) #two grouping variables
des.mat <- describeBy(age ~ education,mat=TRUE,data = sat.act) #matrix (data.frame) output
des.mat <- describeBy(age ~ education + gender, data=sat.act,
mat=TRUE,digits=2) #matrix output rounded to 2 decimals
Run the code above in your browser using DataLab