treetable {TT}R Documentation

Display tree structured data using 'datatable' widget

Description

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.

Usage

treetable(data, color = "#0177A5", colnames = list(), ...)

Arguments

data

data.tree object. treetable will extract all arguments in alphabetical order - these will be a columns. For renaming and ordering of the columns see colnames.

color

base color (hue) to color the table. Each level will differ with saturation and luminosity.

colnames

if list() of characters provided, arguments of data.tree (columns) will be renamed. If vector() provided, columns will be renamed as for list input, additionally columns will be reordered according to vector level after renaming.

...

datatable parameters

Details

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/

Value

Return 'HTML' widget using the 'JavaScript' library 'DataTables'

References

https://github.com/zielaskowski/tree-table

See Also

datatable
data.tree

Examples

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))


[Package TT version 0.98 Index]