opt <- DescToolsOptions()
# define some special formats for count data, percentages and numeric results
# (those will be supported by TOne)
Fmt(abs=as.fmt(digits=0, big.mark="'"))
Fmt(per=as.fmt(digits=1, fmt="%"))
Fmt(num=as.fmt(digits=1, big.mark="'"))
TOne(x = d.pizza[, c("temperature","delivery_min","driver","wine_ordered")],
grp=d.pizza$quality)
# define median/IQR as describing functions for the numeric variables
TOne(iris[, -5], iris[, 5],
FUN = function(x) gettextf("%s / %s",
Format(median(x, na.rm=TRUE), digits=1),
Format(IQR(x, na.rm=TRUE), digits=3))
)
# replace kruskal.test by ANOVA and report the p.value
TOne(x = iris[, -5], grp = iris[, 5],
FUN = function(x) gettextf("%s / %s",
Format(mean(x, na.rm=TRUE), digits=1),
Format(sd(x, na.rm=TRUE), digits=3)),
NUMTEST = function(x, g)
Format(summary(aov(x ~ g))[[1]][1, "Pr(>F)"], fmt="p"),
numtestlab = "ANOVA"
)
options(opt)
## Not run: -- Send the whole stuff to Word
#
# wrd <- GetNewWrd()
# ToWrd(TOne(x = d.pizza[, c("temperature","delivery_min","driver","wine_ordered")],
# grp=d.pizza$quality))
# ## End(Not run)
Run the code above in your browser using DataLab