print.regexport: Print methods for regexport and reglist

View source: R/print.regexport.R

print.regexportR Documentation

Print methods for regexport and reglist

Description

Print methods for regexport and reglist

Usage

## S3 method for class 'regexport'
print(
  reg,
  order = NULL,
  altnames = c(`^\\(Intercept\\)$` = "Constant"),
  suppress = NULL,
  digits = 3,
  sumstats = c("R-squared", "Adj. R-squared", "Observations"),
  notes = "*** p<0.01, ** p<0.05, * p<0.1",
  siglevels = c(0.1, 0.05, 0.01),
  sigformats = paste0("%1.", digits, "f", c("   ", "*  ", "** ", "***"))
)

## S3 method for class 'reglist'
print(
  reglist,
  order = NULL,
  altnames = c(`^\\(Intercept\\)$` = "Constant"),
  suppress = NULL,
  digits = 3,
  sumstats = c("R-squared", "Adj. R-squared", "Observations"),
  notes = "*** p<0.01, ** p<0.05, * p<0.1",
  siglevels = c(0.1, 0.05, 0.01),
  sigformats = paste0("%1.", digits, "f", c("   ", "*  ", "** ", "***"))
)

Arguments

reg

A regression model

order

A list of variable names to move to the top of the output table in the order specified

suppress

A regular expression or vector of regressors to be suppressed from the output (useful for fixed effects)

digits

The number of digits to use for rounding

sumstats

Which summary statistics to output in the table

notes

A character with notes to be shown at the bottom of the output

siglevels

A numeric vector with significance levels below which special formatting will be used (typically stars); levels should be ordered from least to most significant (i.e. largest to smallest)

sigformats

A character vector with sprintf formats to use when outputting the data; the first element should be the output format for coefficients that are not significant at any level, followed by the formats for those significant at each level in siglevels

alt.names

A named character vector giving the alternative names for input variables; the vector results will replace the names

Details

These methods produce nicely formatted console output for objects of class regexport or reglist. The output captured here is nice enough for many purposes, such as quick sharing in e-mail. For more professional outputs, the other functions in this package will be more suitable.

as.data.frame.reglist is at the core of these methods; converting a reglist object to a data frame will yield a data frame which will look essentially the same when printed, except without the notes. This could be useful for output to a csv file or other purposes.

Examples

test <- list(lm(mpg~cyl+disp, data = mtcars),
             lm(mpg~cyl+disp+hp, data = mtcars),
             lm(mpg~cyl+disp+hp+drat, data = mtcars),
             lm(mpg~hp+drat+wt, data = mtcars))

test <- as.regexport(test)
print(test) # An object of class reglist

test <- test[[1]]

print(test) # An object of class regexport


philbastian/regexport documentation built on Sept. 12, 2023, 3:25 p.m.