r4fun / hierplane

🌳 Hierplane for R
https://r4fun.github.io/hierplane/
Other
9 stars 0 forks source link

Allow root-only input #27

Closed mathidachuk closed 4 years ago

mathidachuk commented 4 years ago

Closes #19

library(hierplane)

df <- structure(
  list(
    parent_id = c("Bob", "Bob", "Bob", "Bob", "Angelica", "Bob"),
    child_id = c("Bob", "Angelica", "Eliza", "Peggy", "John", "Jess"),
    child = c("Bob", "Angelica", "Eliza", "Peggy", "John", "Jess"),
    node_type = c("gen1", "gen2", "gen2", "gen2", "gen3", "ext"),
    link = c("ROOT", "daughter", "daughter", "daughter", "son", "cousin"),
    height = c("100 cm", "100 cm", "90 cm", "50 cm", "10 cm", "70 cm"),
    age = c("60 yo", "30 yo", "25 yo", "10 yo", "0.5 yo", "150 yo")
  ),
  row.names = c(NA, -6L),
  class = c("data.frame")
)

df_dataframe <- hp_dataframe(
  .data = df[df$link == "ROOT", ],
  title = "Family",
  settings = hierplane_settings(
    attributes = c("height", "age")
  )
)

hierplane(df_dataframe)

df_spacyr <- hp_spacyr("Bob")

hierplane(df_spacyr, theme = "dark")
tylerlittlefield commented 4 years ago

Poor bob... so lonely, this looks good to me, thanks!