# NOT RUN {
# we can't get this through the CRAN test - run it with copy/paste to console
wrd <- GetNewWrd()
ToWrd("This is centered Text in Arial Black\n",
para=list(Alignment=wdConst$wdAlignParagraphCenter,
SpaceBefore=3, SpaceAfter=6),
font=list(name="Arial Black", size=14),
wrd=wrd)
sel <- wrd$Selection()$Borders(wdConst$wdBorderBottom)
sel[["LineStyle"]] <- wdConst$wdLineStyleSingle
t1 <- TOne(x = d.pizza[, c("temperature","delivery_min","driver","wine_ordered")],
grp=d.pizza$wine_delivered)
ToWrd(t1, font=list(name="Algerian"), wrd=wrd)
tab <- table(d.pizza$driver, d.pizza$area)
tab <- table(d.pizza$driver, d.pizza$area)
ToWrd(tab, font = list(size=15, name="Arial"), row.names = TRUE, col.names = TRUE,
main= "my Title", wrd=wrd)
ToWrd(tab, font = list(size=10, name="Arial narrow"),
row.names = TRUE, col.names=FALSE, wrd=wrd)
ToWrd(tab, font = list(size=15, name="Arial"), align="r",
row.names = FALSE, col.names=TRUE, wrd=wrd)
ToWrd(tab, font = list(size=15, name="Arial"),
row.names = FALSE, col.names=FALSE, wrd=wrd)
ToWrd(tab, tablestyle = "Mittlere Schattierung 2 - Akzent 4",
row.names=TRUE, col.names=TRUE, wrd=wrd)
ToWrd(Format(tab, big.mark = "'", digits=0), wrd=wrd)
zz <- ToWrd(Format(tab, big.mark = "'", digits=0), wrd=wrd)
zz$Rows(1)$Select()
WrdFont(wrd = wrd) <- list(name="Algerian", size=14, bold=TRUE)
# Send a TMod table to Word using a split to separate columns
r.ols <- lm(Fertility ~ . , swiss)
r.gam <- glm(Fertility ~ . , swiss, family=Gamma(link="identity"))
# Build the model table for some two models, creating a user defined
# reporting function (FUN) with | as column splitter
tm <- TMod(OLS=r.ols, Gamma=r.gam,
FUN=function(est, se, tval, pval, lci, uci){
gettextf("<!-- %s|[%s, %s]|%s", -->
Format(est, fmt=Fmt("num"), digits=2),
Format(lci, fmt=Fmt("num"), digits=2),
Format(uci, fmt=Fmt("num"), digits=2),
Format(pval, fmt="*")
)})
# send it to Word, where we get a table with 3 columns per model
# coef | confint | p-val
wrd <- GetNewWrd()
ToWrd(tm, split="|", align=StrSplit("lrclrcl"))
)
# }
Run the code above in your browser using DataLab