# NOT RUN {
# mtcars examples
ttt(mtcars)
ttt(mtcars, mpg ~ gear | cyl, lab="Cylinders")
ttt(mpg ~ gear | cyl, data=mtcars, lab="Cylinders")
ttt(rownames(mtcars) ~ gear | cyl, data=mtcars,
render=paste, collapse="<br/>", lab="Cylinders")
# OrchardSprays examples
ttt(head(OrchardSprays, 12))
ttt(head(OrchardSprays, 12), row.names=FALSE)
ttt(treatment ~ rowpos | colpos, data=OrchardSprays, lab="colpos")
ttt(paste(treatment, decrease, sep="<br/>") ~ rowpos | colpos, data=OrchardSprays, lab="colpos")
rndr.meansd <- function(x) formatC(c(Mean=mean(x), SD=sd(x)), digits=3)
ttt(decrease ~ treatment, data=OrchardSprays, render=rndr.meansd, expand.along="rows")
ttt(decrease ~ treatment, data=OrchardSprays, render=rndr.meansd, expand.along="columns")
# ToothGrowth examples
ttt(len ~ dose | supp, data=ToothGrowth, lab="Mean (SD)",
render=function(x) sprintf("%0.3g (%0.3g)", mean(x), sd(x)))
ttt(len ~ dose | supp, data=ToothGrowth, lab="Supplement Type",
render=rndr.meansd)
ttt(len ~ dose | supp, data=ToothGrowth, lab="Supplement Type",
render=rndr.meansd, expand.along="columns")
# }
Run the code above in your browser using DataLab