d3tree: d3tree

Description Usage Arguments Details Examples

View source: R/d3tree.R

Description

Htmlwidget that binds to d3js trees. When used in Shiny environment the widget returns a data.frame of logical expressions that represent the current state of the tree.

Usage

1
2
d3tree(data, name = "name", value = "value", direction = "horizontal",
  activeReturn = NULL, width = NULL, height = NULL, elementId = NULL)

Arguments

data

named list containing hierarchy structure of data created by df2tree and the layout of the tree (collapse,radial,cartesian)

name

character containing the names of the nodes

value

charater containing the name of the tooltip column that are used in the leafs

direction

charater containing the direction the collapsible tree layout will grow to horizontal or vertical (can be 'h','v')

activeReturn

character vector of node attributes to observe and return to shiny.

width, height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

elementId

The input slot that will be used to access the element.

Details

activeReturn is set to NULL by default, but can return any attributes that are strings or numeric such as: name,value,depth,id. Any node attributes requested that are not found in the node keys are ignored.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 


if(interactive()){

d3tree(list(root = df2tree(rootname='Titanic',
                           struct=as.data.frame(Titanic)
                           ),
            layout = 'collapse')
      )

d3tree(list(root = df2tree(rootname='Titanic',
                           struct=as.data.frame(Titanic),
                           toolTip=letters[1:(ncol(as.data.frame(Titanic))+1)]),
            layout = 'collapse')
      )

d3tree(list(root = df2tree(rootname = 'book',
                           struct = stan.models),
            layout = 'collapse')
      )
}

d3Tree documentation built on June 20, 2017, 9:15 a.m.