print.regexport: Print methods for regexport and reglist

Description Usage Arguments Details Examples

View source: R/print.regexport.R

Description

Print methods for regexport and reglist

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 July 23, 2020, 11:24 p.m.