nice_table | R Documentation |
This function takes a data frame and formats it into a nicely formatted HTML
table using the gt
packages.
nice_table(
x,
title = NULL,
footnote = NULL,
spanner = NULL,
row_group = NULL,
row_group_order = NULL,
rownames = FALSE,
file = NULL,
cols_label = NULL,
decimals = NULL,
round = NULL,
label_na = NULL,
markdown = FALSE,
gt = NULL,
...
)
x |
The data frame to be formatted into a table |
title |
Title string. |
footnote |
Add footnote |
spanner |
List with information on grouping columns. E.g. |
row_group |
List with information on grouping rows |
row_group_order |
List with information on grouping order. |
rownames |
Logical. If TRUE, rownames are shown. |
file |
Character string with filename. If set, an additional file is
exported (html or docx format is possible). If set |
cols_label |
List with renaming information for columns (old_name = new_name). |
decimals |
Number of decimals that will be printed. |
round |
Number of digits to which numbers should be rounded. |
label_na |
= Label for replacing missing values. |
markdown |
If TRUE, interprets cell content as markdown. |
gt |
Additional arguments passed to |
... |
Various arguments for backward compatibility. |
A gt table object.
df <- data.frame(
x = 1:5, y = rnorm(5, mean = 10, sd = 12),
c = letters[5:1], d = sample(letters, 5)
)
nice_table(
df,
title = "A nice title",
footnote = c("Footnote 1", "Footnote 2"),
spanner = list("One" = 1:2, "Two" = 3:4),
row_group = list("Start" = 1:2, "That is the second" = 3:5),
cols_label = list(x = "First", y = "Second", c = "Third", d = "Fourth"),
decimals = 1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.