texreg(l, file = NULL, 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, override.ci.low = 0, override.ci.up = 0,
omit.coef = NULL, reorder.coef = NULL, reorder.gof = NULL,
ci.force = FALSE, ci.force.level = 0.95, ci.test = 0,
groups = NULL, bold = 0.00, center = TRUE,
caption = "Statistical models", caption.above = FALSE,
label = "table:coefficients", booktabs = FALSE,
dcolumn = FALSE, sideways = FALSE, longtable = FALSE,
use.packages = TRUE, table = TRUE, no.margin = TRUE,
fontsize = NULL, scalebox = NULL, float.pos = "", ...)htmlreg(l, file = NULL, 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, override.ci.low = 0, override.ci.up = 0,
omit.coef = NULL, reorder.coef = NULL, reorder.gof = NULL,
ci.force = FALSE, ci.force.level = 0.95, ci.test = 0,
groups = NULL, 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,
indentation = "", vertical.align.px = 0, ...)
screenreg(l, file = NULL, 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, override.ci.low = 0, override.ci.up = 0,
omit.coef = NULL, reorder.coef = NULL, reorder.gof = NULL,
ci.force = FALSE, ci.force.level = 0.95, ci.test = 0,
groups = NULL, column.spacing = 2, outer.rule = "=",
inner.rule = "-", ...)
l = list(model.1, model.2, ...). Different object types can also be mixed.single.rstars = 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.coef.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 ocustom.coef.namecustom.note = ""), the note will be omitted completely. If some character string is provided (e.g., 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 toverride.ci.up argument, the standard errors and p values as well as the override.ci.low argument, the standard errors and p values as well as the omit.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)ci.force argument is used to convert standard errors to confidence intervals, what confidence level should be used? By default, 0.95 is used (i.e., an alpha value of 0.05).ci.test argument specifies the reference value to establish whether a coefficient/CI is significant. The default value ci.test = 0, for example, will attach a significance star to coeffictexreg 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 longtable = TRUE is set, the longtable environment from the longtable LaTeX package is used to set tables across multiple pages. Note that this argument is not compatibletexreg 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 = FALSEtexreg 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] The fontsize argument serves to change the font size used in the table. Valid values are "tiny", "scriptsize", "footnotesize", "small", "normtexreg function] The scalebox argument serves to resize the table. For example, scalebox = 1.0 is equivalent to the normal size, scalebox = 0.5 decreases the size of the table by one half, atexreg 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 htmlreg function] Characters used for indentation of the HTML code. By default, indentation = "" uses no indentation. Any number of spaces or characters can be used instead. For example, indentation = ""htmlreg function] Vertical alignment of significance stars. Browsers differ in their ways of displaying superscripted significance stars; in some browsers the stars are elevated by default, and in other browsers the stars are aliscreenreg 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 plotreg#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