regexcel: Output a regression to Excel

View source: R/regexcel.R

regexcelR Documentation

Output a regression to Excel

Description

Output a regression to Excel

Usage

regexcel(
  reglist,
  file = "output.xlsx",
  sheet = "Regression",
  order = NULL,
  altnames = NULL,
  regnames = NULL,
  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),
  coefstyles = NULL,
  sumstyles = NULL,
  sestyle = NULL,
  startrow = 1
)

Arguments

reglist

Regression output or a list of regression outputs that can be coerced into class reglist

file

An openxlsx workbook or the name of a new Excel file to create where output should be stored

sheet

The name of the worksheet where results should be saved

order

The order of variables in the coefficient list; any variables not in this list will be ordered automatically according to their order in the input regression models

altnames

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

regnames

An optional vector with names for each regression to place on the row above the variable names (if NULL, this line will be omitted).

suppress

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

siglevels

What are the significance levels for which special formatting should be used?

sigstyles

What styles should be used for each of the significance levels? Defaults to typical stars used in regression tables

note

Any notes to include at the bottom. Using "%stars%" will include the levels used for significance testing if the default stars are used

Details

The regexcel function is used to output regressions to xlsx format for presentation or further analysis in Microsoft Excel or other software that can read xlsx files. Because many users will wish to continue their analysis in Excel, regexcel produces output that preserves numerical formatting, but still produces the typical stars

Examples

data <- data.frame(x = c(2, 4, 5, 6, 8, 10), y = c(1, 1, 2, 2, 3, 3))
regression <- lm(y ~ x, data = data)
regexcel(regression)

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