| xtable.xbal {RItools} | R Documentation |
This function uses the xtable package framework to display the results of a call to xBalance in LaTeX format. At the moment, it ignores the omnibus chi-squared test information.
## S3 method for class 'xbal':
xtable(x, caption = NULL, label = NULL, align = c("l",rep("r",ncol(xvardf))), digits = 2, display = NULL, col.labels = NULL, ...)
x |
an object resulting from a call to xBalance |
caption |
See xtable. |
label |
See xtable. |
align |
See xtable. Our default (as of
version 0.1-7) is right-aligned columns; for decimal aligned
columns, see details, below. |
digits |
See xtable. Default is 2. |
display |
See xtable |
col.labels |
Labels for the columns (the test
statistics). Default are come from the call to print.xbal. |
... |
Other arguments to print.xbal |
To get decimal aligned
columns, specify align c("l", rep(".", ncol(xvardf))) in your
call to xtable. Then use the dcolumn package within LaTeX
and also a new column definition using \newcolumntype{.}{D{.}{.}{2.2}.
This function produces an xtable object which can then be printed with
the appropriate print method (see print.xtable).
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
data(nuclearplants)
require(xtable)
xb1<-xBalance(pr~ date + t1 + t2 + cap + ne + ct + bw + cum.n,
strata=data.frame(unstrat=factor(character(32)),
pt=factor(nuclearplants$pt)),
data=nuclearplants,
report=c('adj.means','adj.mean.diffs','std.diffs', 'z.scores', 'chisquare.test','p.values'))
xb1.xtab<-xtable(xb1) ##right aligned
##xb1.xtab<-xtable(xb1,align = c("l",rep(".",ncol(xvardf)))) ##decimal aligned, see Details above.
print(xb1.xtab,add.to.row=attr(xb1.xtab,"latex.add.to.row"),hline.after=c(0,nrow(xb1.xtab)),sanitize.text.function=function(x){x},floating=TRUE,floating.environment="sidewaystable")