Description Usage Arguments Details Value See Also
This function is useful for creating visually pleasing Financial Statement using the DT Package. Features of this function:
1. numbers are formatted by row by providing row_type vector. supported formats are currecny, percent, comma and accounting. This feature makes use of formattable package.
2. negative numbers can be colored coded to red if color_negative is TRUE
3. supports all css of div tag by surrounding text with
<div class="...">your-text</div>
.
1 2 | createFSTable(df, id, row_type, row_format_rule = "default", row_css,
color_negative = TRUE)
|
df |
a data frame |
id |
id columns for the data frame. Columns other than id columns must be numeric |
row_type |
a character vector, its length must equal to number of rows in
df. Types for each row,valid choices are "currency","percent", "comma" and
"accounting". To add more valid choices,
modify |
row_format_rule |
when set to |
row_css |
a data frame, it must have the same number of rows as df. column names should be valid css attributes. columns must contain valid values for corresponding attributes. |
color_negative |
default to |
1.row_format_rule:
When row_format_rule
is default
, it will use the rules in
link{FSDTSampleData}
.
Now this function supports four formats, which are "currency","percent","comma" and "accounting", it uses functions in formattable package. To customize rules, you must provide a list with the four type names as key. For each key value pair, the value must also be a list with keyword, digits as key. When setting up "currency", you can also use "symbol" as key.
A valid rule should look like list(
currency = list(keywords = c("Dollar","amount","currency"), digits = 2, symbol = "$"),
percent = list(keyword = c("percent","percentage"),digits = 2),
... etc
)
a data frame, cells contains HTML text, which can be parsed by
DT::datatable
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.