Learn R Programming

d3Tree (version 0.3.0)

df2tree: df2tree

Description

converts dataframe to json to send to javascript

Usage

df2tree(struct, rootname = "root", tool_tip = NULL)

Arguments

struct

data.frame containing the structure the tree will represent

rootname

character name of the root node

tool_tip

charater vector of the label to give to the nodes in each hierarchy

Examples

Run this code
titanic_df <- as.data.frame(Titanic)

df2tree(struct = titanic_df,rootname = 'Titanic')

df2tree(
  struct = titanic_df,
  rootname = 'Titanic',
  tool_tip = letters[1:5]
)

Run the code above in your browser using DataLab