This function prints a styled table in either HTML or LaTeX format, depending on the output document type.

print_table(
  df,
  num_col = 1,
  rowname = NA,
  caption = "",
  digits = 2,
  fontsize = 9,
  big.mark = ",",
  na_str = "",
  ...
)

Arguments

df

The data frame to be formatted as a table.

num_col

An integer specifying the number of columns to split the output table into (default: 1).

rowname

A character string specifying the column name for the row names; if not provided, the row names will not be printed (default: NA).

caption

A character string specifying the caption for the table (default: ”).

digits

An integer indicating the number of digits to display (default: 2).

fontsize

Font size for the table (default: 9).

big.mark

A character string used as the thousands separator for numbers (default: ',').

na_str

A string used to replace missing values (default: ”).

...

Additional arguments to be passed to the formatting functions.

Value

A styled table in HTML or LaTeX format, depending on the document type.

Examples

print_table(mtcars[1:10, 1:3], num_col = 2, rowname = 'car')

car

mpg

cyl

disp

car

mpg

cyl

disp

Mazda RX4

21.00

6.00

160.00

Valiant

18.10

6.00

225.00

Mazda RX4 Wag

21.00

6.00

160.00

Duster 360

14.30

8.00

360.00

Datsun 710

22.80

4.00

108.00

Merc 240D

24.40

4.00

146.70

Hornet 4 Drive

21.40

6.00

258.00

Merc 230

22.80

4.00

140.80

Hornet Sportabout

18.70

8.00

360.00

Merc 280

19.20

6.00

167.60