regtable_stack: Stack Multiple Regression Outputs

Description Usage Arguments Examples

Description

This routine takes in multiple outputs from regtable and arranges them into one output. The function stacks the different coefficients and summary statistics, while the extra_rows are grouped at the bottom of the regtable_stack() output.

Usage

1
2
regtable_stack(final_tables, table_names = NULL,
  output_format = "latex", note = NULL, header = NULL)

Arguments

final_tables

list of output produced by regtable, which includes

  • output: a dataframe version of the regtable results

  • model_names: either the character vector specified by mnames in regtable or a function generated vector of numeric IDs for the models

To output a dataframe in regtable, pass in "df" for the output_format.

table_names

A character vector specifying the names of the objects in final_tables. These names are concatenated with the coefficent names in the output.

output_format

A string passed to kable() that specifies the format of the table output. The options are latex, html, markdown, pandoc, and rst. The default is latex.

note

A character string if a footnote is to be added to the end of the table.

header

A character vector to be passed into add_header_above that creates a new header row. This should have length equal to ms from regtable()

Examples

 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
26
27
28
# create covariates
x1 <- rnorm(1000)
x2 <- rnorm(length(x1))

# fixed effects
fe <- factor(sample(20, length(x1), replace=TRUE))

# effects for fe
fe_effs <- rnorm(nlevels(fe))

# creating left hand sides y1 and y2
u <- rnorm(length(x1))
y1 <- 2 * x1 + x2 + fe_effs[fe] + u
y2 <- 3 * x1 + x2 + fe_effs[fe] + u

m1 <- felm(y1 ~ x1 + x2 | fe)
m2 <- lm(y1 ~ x1 + x2)

n1 <- felm(y2 ~ x1 + x2 | fe)
n2 <- lm(y2 ~ x1 + x2)

# generate output from regtable
r1 <- regtable(list(m1, m2), est = "x1", 
       output_format = "df")
r2 <- regtable(list(n1, n2), est = "x1", 
       output_format = "df")

regtable_stack(list(r1, r2), table_names = c("1", "2"), output_format = "rst")

yixinsun1216/catwalk documentation built on May 31, 2019, 4:56 a.m.