add_layer: Add Layer for hierarchical dataframe

Description Usage Arguments Examples

View source: R/builder.R

Description

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

Usage

1
2
3
4
5
6
7
8
9
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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()

r4fun/hierplane documentation built on Aug. 1, 2020, 9:48 a.m.