d3_party {d3r}R Documentation

Convert partykit to d3.js hierarchy

Description

This thing is not even close to being done, so please help with ideas and contributions.

Usage

d3_party(tree = NULL, json = TRUE)

Arguments

tree

partykit object to be converted

json

logical to return list or json

Value

list or json depending on json arg

Examples

## Not run: 

  library(d3r)
  # from ?rpart
  data("kyphosis", package="rpart")
  d3_party(
    rpart::rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)
  )

  # if you want the list instead of json
  d3_party(
    rpart::rpart(Kyphosis ~ Age + Number + Start, data = kyphosis),
    json = FALSE
  )

  # with ctree instead of rpart
  #  using example from ?ctree
  d3_party(partykit::ctree(Species ~ .,data = iris))


  #devtools::install_github("timelyportfolio/d3treeR")

  library(d3treeR)

  d3tree2(
    d3_party(
      rpart::rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)
    ),
    celltext = "rule",
    valueField = "n"
  )


## End(Not run)

[Package d3r version 1.1.0 Index]