Used in conjunction with add_root() to generate dataframe for use with hp_dataframe().

add_layer(
  .data,
  child_col,
  node_type_col = NULL,
  node_type_vals = " ",
  link_col = NULL,
  link_vals = " ",
  attribute_cols = NULL
)

Arguments

.data

Output from add_root() or add_layer().

child_col

Column to generate children from.

node_type_col, node_type_vals

Column or values to use as node_type. If not specified, all node types will be assigned as blank (" ") for the layer.

link_col, link_vals

Column or values to use as link. If not specified, all links will be assigned as blank (" ") for the layer.

attribute_cols

Column to use for generating attribute labels.

Examples

os_survey %>% add_root("OS Students 2014/15") %>% add_layer( child_col = "Operating System", link_vals = "OS", node_type_vals = "OS" ) %>% add_layer( child_col = "OS Version", link_vals = "Ver", node_type_vals = "Sub", attribute_cols = "users" ) %>% hp_dataframe( title = "Survey Results of Most Popular OS in 2014/15", styles = hierplane_styles( link_to_positions = list(Ver = "right") ) ) %>% hierplane()