treetable | R Documentation |
Wrapper of 'datatable' widget, allowing display of 'data.tree' objects. All arguments of the 'data.tree' become columns and each node is a row. Adds column with buttons allowing folding and unfolding the levels.
treetable(data, color = "#0177A5", colnames = list(), ...)
data |
data.tree object. |
color |
base color (hue) to color the table. Each level will differ with saturation and luminosity. |
colnames |
if |
... |
datatable parameters |
Package consist of treetable function (wrapper of 'datatable') that
convert data.tree object to 'dataframe' and 'JS' callback function called
after creating the table. Treetable function ads hidden columns used by 'JS'
for formatting and folding/unfolding level rows. Hidden columns shall be
completely transparent for user
Package also include 'DT::format...' functions wrappers, which are working
exactly as originals, but are necessary to protect special (helper) columns
used by 'JS' callback function for formatting.
Color formatting is done by 'kolorWheel' 'JS' script done by Zalka Erno
e-mail: ern0[at]linkbroker.hu
http://linkbroker.hu/stuff/kolorwheel.js/
Return 'HTML' widget using the 'JavaScript' library 'DataTables'
https://github.com/zielaskowski/tree-table
datatable
data.tree
data("org") data("col_order") colnames <- factor(c("org",org$attributesAll), levels = col_order) treetable(org, color="#FFFFFF", colnames=colnames) # still datatable works as expected when data.frame provided treetable(data.frame( date = seq(as.Date("2015-01-01"), by = "day", length.out = 5), x = 1:5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.