table2tex | R Documentation |
Export currently showing R stats object or stats object obj to a HTML or Latex table
table2tex( x = NULL, file = "Rtable", type = "TEX", digits = 2, digitspvals = 2, trim.pval = 1e-16, summary = FALSE, standAlone = TRUE, add.rownames = FALSE, ... ) table2html(...)
x |
given R stats object or list of stats objects to export; if set to |
file |
name of output file. The appropriate extension is added automatically. |
type |
desired output type - |
digits |
number of significant digits to show for all columns except for the column with p values. |
digitspvals |
number of significant digits to show for columns with p values. |
trim.pval |
a threshold below which the p-values are trimmed as
"< |
summary |
logical indicating whether or not to summarize data files. |
standAlone |
logical indicating whether exported Latex code should be standalone compilable, or whether it will be pasted into another document. |
add.rownames |
logical indicating whether the names of the rows should be added to the table (inserting a column before first column). |
... |
extra options are passed on to stargazer. |
Objects that can be exported are all those supported by xtable
,
tidy
(see table2office
for an extensive list of supported
methods), or stargazer
. The models supported by
stargazer
are:
aftreg
(eha
)
anova
(stats
)
aov
(stats
)
aovlist
(stats
)
arima
(stats
)
betareg
(betareg
)
binaryChoice
(sampleSelection
)
bj
(rms
)
brglm
(brglm
)
censReg
(censReg
)
coeftest
(lmtest
)
coxph
(survival
)
coxreg
(eha
)
clm
(ordinal
)
clogit
(survival
)
cph
(rms
)
dynlm
(dynlm
)
ergm
(ergm
)
errorsarlm
(spdev
)
felm
(lfe
)
gam
(mgcv
)
garchFit
(fGarch
)
gee
(gee
)
glm
(stats
)
Glm
(rms
)
glmer
(lme4
)
glmrob
(robustbase
)
gls
(nlme
)
Gls
(rms
)
gmm
(gmm
)
heckit
(sampleSelection
)
hetglm
(glmx
)
hurdle
(pscl
)
ivreg
(AER
)
lagarlm
(spdep
)
lm
(stats
)
lme
(nlme
)
lmer
(lme4
)
lmrob
(robustbase
)
lrm
(rms
)
maBina
(erer
)
mclogit
(mclogit
)
mlogit
(mlogit
)
mnlogit
(mnlogit
)
mlreg
(eha
)
multinom
(nnet
)
nlme
(nlme
)
nlmer
(lme4
)
ols
(rms
)
pgmm
(plm
)
phreg
(eha
)
plm
(plm
)
pmg
(plm
)
polr
(MASS
)
psm
(rms
)
rem.dyad
(relevent
)
rlm
(MASS
)
rq
(quantreg
)
Rq
(rms
)
selection
(sampleSelection
)
svyglm
(survey
)
survreg
(survival
)
tobit
(AER
)
weibreg
(eha
)
zeroin
(pscl
)
relogit
(zelig
)
cloglog.net
(zelig
)
gamma.net
(zelig
)
probit.net
(zelig
)
logit.net
(zelig
)
No return value
table2html()
: Export statistical output to HTML table
Tom Wenseleers, Christophe Vanderaa
table2office
,table2ppt
, table2doc
,
stargazer
# Create a file name filen <- tempfile(pattern = "table_aov") # or # filen <- paste("YOUR_DIR/table_aov") # Generate ANOVA output fit=aov(yield ~ block + N * P + K, data = npk) # 'npk' dataset from base 'datasets' x=summary(fit) # Export to Latex in standAlone format if (interactive()) table2tex(x=x,file=filen) # Export to Latex to paste in tex document summary(fit) # get output from the console if (interactive()) table2tex(file=filen, standAlone = FALSE) # Export to HTML if (interactive()) table2html(x=x,file=filen) # or summary(fit) # get output from the console if (interactive()) table2html(file=filen)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.