pretty_num_table | R Documentation |
dfeR::pretty_num()
.You can format number and character values in a data frame
by passing arguments to dfeR::pretty_num()
.
Use parameters include_columns
or exclude_columns
to specify columns for formatting.
pretty_num_table(data, include_columns = NULL, exclude_columns = NULL, ...)
data |
A data frame containing the columns to be formatted. |
include_columns |
A character vector specifying which columns to format.
If |
exclude_columns |
A character vector specifying columns to exclude
from formatting.
If |
... |
Additional arguments passed to |
The function first checks if any columns are specified for inclusion
via include_columns
.
If none are provided, it checks if columns are specified for exclusion
via exclude_columns
.
If neither is specified, all columns in the data frame are formatted.
A data frame with columns formatted using dfeR::pretty_num()
.
pretty_num()
Other prettying:
pretty_filesize()
,
pretty_num()
,
pretty_time_taken()
# Example data frame
df <- data.frame(
a = c(1.234, 5.678, 9.1011),
b = c(10.1112, 20.1314, 30.1516),
c = c("A", "B", "C")
)
# Apply formatting to all columns
pretty_num_table(df, dp = 2)
# Apply formatting to only selected columns
pretty_num_table(df, include_columns = c("a"), dp = 2)
# Apply formatting to all columns except specified ones
pretty_num_table(df, exclude_columns = c("b"), dp = 2)
# Apply formatting to all columns except specified ones and
# provide alternative value for NAs
pretty_num_table(df, alt_na = "[z]", exclude_columns = c("b"), dp = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.