Custom table for sa4ss

table_format(
  x,
  format = "latex",
  caption = "Add Caption",
  label = NULL,
  digits = getOption("digits"),
  booktabs = TRUE,
  col_names = NULL,
  linesep = "",
  longtable = TRUE,
  font_size = 10,
  align = "c",
  col_names_align = "c",
  hold_position = TRUE,
  escape = TRUE,
  bold_header = FALSE,
  landscape = FALSE,
  repeat_header = FALSE,
  header_grouping = NULL,
  format.args = NULL,
  custom_width = FALSE,
  col_to_adjust = NULL,
  width = NULL,
  create_png = FALSE,
  ...
)

Arguments

x

An R object, typically a matrix or data frame.

format

As defined by kableExtra::kbl(). Default for sa4ss is 'latex'.

caption

As defined by kableExtra::kbl().

label

As defined by kableExtra::kbl().

digits

As defined by kableExtra::kbl().

booktabs

As defined by kableExtra::kbl(). Logical.

col_names

Names for the columns to show on table.

linesep

As defined by kableExtra::kbl().

longtable

As defined by kableExtra::kbl().

font_size

Font size in pts. If NULL, document font size is used.

align

As defined by kableExtra::kbl().

col_names_align

As defined in kableExtra::linebreak().

hold_position

As defined in kableExtra::kable_styling(). Logical.

escape

As defined by kableExtra::kable_styling().

bold_header

Make headers bold. Logical

landscape

Make this table in landscape orientation?

repeat_header

If landscape, repeat the header on subsequent pages?

header_grouping

As defined by kableExtra::kable_styling()

format.args

As defined by kableExtra::kbl().

custom_width

Logical. Allow for custom column widths

col_to_adjust

Vector of columns to adjust width. Only used if custom_width = TRUE.

width

Vector or single value of column widths (i.e. c('2cm', '2cm')) for the columns defined in the col_to_adjust.

create_png

Logical. If set to true tables will be created as png objects in the doc.

...

Extra arguments supplied to kbl.

Examples

table_format(head(iris))
#> Need to define label to reference table.
#> \begingroup\fontsize{10}{12}\selectfont
#> \begingroup\fontsize{10}{12}\selectfont
#> 
#> \begin{longtable}[t]{c>{\centering\arraybackslash}p{1.6cm}>{\centering\arraybackslash}p{1.6cm}>{\centering\arraybackslash}p{1.6cm}>{\centering\arraybackslash}p{1.6cm}}
#> \caption{Add Caption}\\
#> \toprule
#> Sepal.Length & Sepal.Width & Petal.Length & Petal.Width & Species\\
#> \midrule
#> \endfirsthead
#> \caption[]{Add Caption (\textit{continued)}}\\
#> \toprule
#> Sepal.Length & Sepal.Width & Petal.Length & Petal.Width & Species\\
#> \midrule
#> \endhead
#> 
#> \endfoot
#> \bottomrule
#> \endlastfoot
#> 5.1 & 3.5 & 1.4 & 0.2 & setosa\\
#> 4.9 & 3.0 & 1.4 & 0.2 & setosa\\
#> 4.7 & 3.2 & 1.3 & 0.2 & setosa\\
#> 4.6 & 3.1 & 1.5 & 0.2 & setosa\\
#> 5.0 & 3.6 & 1.4 & 0.2 & setosa\\
#> 5.4 & 3.9 & 1.7 & 0.4 & setosa\\*
#> \end{longtable}
#> \endgroup{}
#> \endgroup{}