texreg(l, file = NA, single.row = FALSE, stars = c(0.001,
0.01, 0.05), custom.model.names = NULL,
custom.coef.names = NULL, custom.gof.names = NULL,
custom.note = NULL, digits = 2, leading.zero = TRUE,
symbol = "\\cdot", override.coef = 0, override.se = 0,
override.pval = 0, omit.coef = NA, reorder.coef = NULL,
reorder.gof = NULL, return.string = FALSE, bold = 0.00,
center = TRUE, caption = "Statistical models",
caption.above = FALSE, label = "table:coefficients",
booktabs = FALSE, dcolumn = FALSE, sideways = FALSE,
use.packages = TRUE, table = TRUE, no.margin = TRUE,
scriptsize = FALSE, float.pos = "", ...)htmlreg(l, file = NA, single.row = FALSE, stars = c(0.001,
0.01, 0.05), custom.model.names = NULL,
custom.coef.names = NULL, custom.gof.names = NULL,
custom.note = NULL, digits = 2, leading.zero = TRUE,
symbol = "·", override.coef = 0, override.se = 0,
override.pval = 0, omit.coef = NA, reorder.coef = NULL,
reorder.gof = NULL, return.string = FALSE, bold = 0.00,
center = TRUE, caption = "Statistical models",
caption.above = FALSE, star.symbol = "*",
inline.css = TRUE, doctype = TRUE, html.tag = FALSE,
head.tag = FALSE, body.tag = FALSE, ...)
screenreg(l, file = NA, single.row = FALSE, stars = c(0.001,
0.01, 0.05), custom.model.names = NULL,
custom.coef.names = NULL, custom.gof.names = NULL,
custom.note = NULL, digits = 2, leading.zero = TRUE,
symbol = ".", override.coef = 0, override.se = 0,
override.pval = 0, omit.coef = NA, reorder.coef = NULL,
reorder.gof = NULL, return.string = FALSE,
column.spacing = 2, outer.rule = "=", inner.rule = "-",
...)
l = list(model.1, model.2, ...)
. Different object types can also be mixed.single.r
stars = numeric(0)
will not print any stars and will not print any note about significance levels below the tmodel.names = c("My name 1", "My name 2")
etc. overrides the default behavior.custom.names
argument can be used to replace them by other character strings in the order of appearance. For example, if a table shows a total of three differencustom.coef.name
custom.note = ""
), the note will be omitted completely.digits
argument in the round
function of the 0.35
). This is also the default texreg behavior. Some journals, however, require omission of leading zeros (for example, .35
). This can be achistars
argument, p values smaller than the largest threshold value but larger than the second-largest threshold value are denoted by this symbol. The default symbol is "\\cdot"
for tomit.coef = "group"
deletes all coefficient rows from the table where the name of the coefficient contains the character sequencereorder.coef = c(3, 2, 1)
will put treorder.gof = c(3, 2, 1)
cat()
function?texreg
and htmlreg
functions] The p value threshold below which the coefficient shall be formatted in a bold font. For example, bold = 0.05
will cause all coefficients which are significant at the 95% letexreg
and htmlreg
functions] Should the table be horizontally aligned at the center of the page?texreg
and htmlreg
functions] Set the caption of the table.texreg
and htmlreg
functions] Should the caption of the table be placed above the table? By default, it is placed below the table.texreg
function] Set the label of the table
environment.texreg
function] Use the booktabs
LaTeX package to get thick horizontal rules in the output table (recommended).texreg
function] Use the dcolumn
LaTeX package to get a nice alignment of the coefficients (recommended).texreg
function] If sideways = TRUE
is set, the table
floating environment is replaced by a sidewaystable
float, and the rotating
package is loaded in the preamble. The argumenttexreg
function] If this argument is set to TRUE
(= the default behavior), the required LaTeX packages are loaded in the beginning. If set to FALSE
, the use package statements are omitted from the outputtexreg
function] By default, texreg puts the actual tabular
object in a table
floating environment. To get only the tabular
object without the whole table header, set table = FALSE
texreg
function] In order to save space, inner margins of tables are switched off by default. To reactivate the default table spacing, set no.margin = FALSE
.texreg
function] To save horizontal space on the page, the table can be set in script size instead of normal text size by setting scriptsize = TRUE
.texreg
function] This argument specifies where the table should be located on the page or in the document. By default, no floating position is specified, and LaTeX takes care of the position automatically. Possible values includehtmlreg
function] Alternative characters for the significance stars can be specified. This is useful if htmlreg
function] Should the CSS stylesheets be embedded directly in the code of the table (inline.css = TRUE
), or should the CSS stylesheets be enclosed in the tag, that is, separated from the table code (htmlreg
function] Should the first line of the HTML code contain the DOCTYPE definition? If TRUE
, the HTML 4 TRANSITIONAL version is used. If FALSE
, no DOCTYPE will be included. Omitting the DOCTYPE can htmlreg
function] Should the table code (and possibly the and tags) be enclosed in an tag? Suppressing this tag is recommended when htmlreg
function] Should the tag (including CSS definitions and title/caption) be included in the HTML code? Suppressing this tag is recommended when htmlreg
function] Should the table code be enclosed in a HTML tag? Suppressing this tag is recommended when screenreg
function] The amount of space between any two columns of a table. By default, two spaces are used. If the tables do not fit on a single page horizontally, the value can be set to 1
or 0
.screenreg
function] The character which is used to draw the outer horizontal line above and below a table. If an empty character object is provided (i.e., outer.rule = ""
), there will be no outer horizontal lines. Rescreenreg
function] The character which is used to draw the inner horizontal line above and below a table. If an empty character object is provided (i.e., outer.rule = ""
), there will be no inner horizontal lines. ReThe texreg()
function creates LaTeX code for inclusion
in a LaTeX document or for usage with
The htmlreg()
function creates HTML code. Tables in HTML
format can be saved with a ".html" extension and displayed in
a web browser. Alternatively, they can be saved with a ".doc"
extension and opened in MS Word for inclusion in office
documents. htmlreg()
also works with inline.css
, doctype
,
html.tag
, head.tag
, and body.tag
arguments
must be adjusted for the different purposes (see the description
of the arguments).
The screenreg()
function creates text representations of
tables and prints them to the R console. This is an alternative
to the summary
method and serves easy model comparison.
Moreover, once a table has been prepared in the R console, it
can be later exported to LaTeX or HTML with little extra effort
because the majority of arguments of the three functions is
identical.
texreg-package extract extract-methods
#Linear mixed-effects models
library(nlme)
model.1 <- lme(distance ~ age, data = Orthodont, random = ~ 1)
model.2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
texreg(list(model.1, model.2), booktabs = TRUE, dcolumn = TRUE)
#Ordinary least squares model (example from the 'lm' help file)
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2,10,20, labels = c("Ctl","Trt"))
weight <- c(ctl, trt)
lm.D9 <- lm(weight ~ group)
table.string <- texreg(lm.D9, return.string = TRUE)
cat(table.string)
#Create a 'fake' Office document containing a regression table
htmlreg(list(model.1, model.2), file = "texreg.doc",
inline.css = FALSE, doctype = TRUE, html.tag = TRUE,
head.tag = TRUE, body.tag = TRUE)
unlink("texreg.doc")
Run the code above in your browser using DataLab