clean_raw {panelsummary}R Documentation

Pass a panelsummary::panelsummary_raw dataframe into kableExtra::kbl() with typical defaults

Description

'clean_raw' Passes a panelsummary::panelsummary_raw dataframe that has (or has not) been edited further into kableExtra::kbl() with default settings that look publication-ready. This includes changing the column names and fixing the alignment.

Usage

clean_raw(
  data.frame,
  alignment = NULL,
  colnames = NULL,
  format = NULL,
  caption = NULL,
  pretty_num = FALSE
)

Arguments

data.frame

The data.frame (or tibble) from panelsummary::panelsummary_raw() that has been manipulated.

alignment

A character string. By default, it is set to left adjusting the first column, and centering the rest of the columns. For example, a model with three columns will have adjustment of "lcc".

colnames

An optional vector of strings. The vector of strings should have the same length as the number columns of the table. * 'NULL' (the default): colnames are defaulted to a whitespace, followed by (1), (2), ....etc.

format

A character string. Possible values are latex, html, pipe (Pandoc's pipe tables), simple (Pandoc's simple tables), and rst. The value of this argument will be automatically determined if the function is called within a knitr document. The format value can also be set in the global option knitr.table.format. If format is a function, it must return a character string.

caption

A string. The table caption.

pretty_num

A logical. If TRUE, then numbers over 999 have a comma printing format.

Value

A raw data frame that is ready for further manipulation.

Examples


## Cleaning a panelsummary_raw dataframe with clean_raw

ols_1 <- lm(mpg ~ hp + cyl, data = mtcars)

panelsummary_raw(ols_1, ols_1) |> clean_raw()





[Package panelsummary version 0.1.2.1 Index]