if (require(car)){
data(Mroz) # from car package
cat("column percents:
")
print(colPercents(xtabs(~ lfp + wc, data=Mroz)))
cat("row percents:
")
print(rowPercents(xtabs(~ hc + lfp, data=Mroz)))
cat("total percents:
")
print(totPercents(xtabs(~ hc + wc, data=Mroz)))
cat("three-way table, column percents:
")
print(colPercents(xtabs(~ lfp + wc + hc, data=Mroz)))
}Run the code above in your browser using DataLab