star_insert_row: Insert a row in a stargazer table

View source: R/star_cleaning_functions.R

star_insert_rowR Documentation

Insert a row in a stargazer table

Description

Insert a row in a stargazer table

Usage

star_insert_row(star, string, insert.after)

Arguments

star

the stargazer output

string

the string of text to insert into the table

insert.after

insert string after inster.after. insert.after can be a vector, so you can insert multiple strings at one time. If insert.after has length 1, then all elements of string are insterted after insert.after.

Value

the updated stargazer output

Examples

## -- Regression Example -- ##
library(stargazer)
data(mtcars)
mod.mtcars.1 <- lm(mpg ~ hp + wt, mtcars)
mod.mtcars.2 <- lm(mpg ~ hp + wt + cyl, mtcars)
mod.mtcars.3 <- lm(hp ~ wt + cyl, mtcars)
##latex example
star.out <- stargazer(mod.mtcars.1, mod.mtcars.2, mod.mtcars.3,
                      type = "latex")
print(star.out)
star_insert_row(star.out, "Controls? & No & No & No \\\\", insert.after = 27)
star_insert_row(star.out,
               c("Controls? & No & No & No \\\\",
                 "Linear Model? & Yes & Yes & Yes \\\\"),
               insert.after = c(27, 32))

ChandlerLutz/starpolishr documentation built on April 16, 2023, 8:55 a.m.