christophergandrud / christophergandrud/networkD3

Creating list for trees with an edgelist

Open
#224 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
659
Forks
259
PR merge metrics
No merged PRs in 30d

Description

Here's a snippet of code when you have an edgelist and want to use it to create one of the tree diagrams (e.g., `radialNetwork`)

```r
library(data.tree)
library(networkD3)

pokemon <- structure(list(name = structure(c(5L, 4L, 6L, 1L, 7L, 3L, 2L), .Label = c("Eevee",
"Flareon", "Jolteon", "Pichu", "Pikachu", "Raichu", "Vaporeon"
), class = "factor"), meta.contruct = structure(c(3L, 1L, 4L,
1L, 2L, 2L, 2L), .Label = c("", "Eevee", "Pichu", "Pikachu"), class = "factor")), .Names = c("name",
"meta.contruct"), class = "data.frame", row.names = c(NA, -7L
))

tree <- FromDataFrameNetwork(pokemon[, 1:2])
pokelist <- ToListExplicit(tree, unname = TRUE)

radialNetwork(pokelist)
```

would this be good to put in the docs for `radialNetwork`?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the radialNetwork documentation and the supplied R example using FromDataFrameNetwork and ToListExplicit. Run the example to confirm it produces the intended tree diagram, then determine where the usage snippet belongs; done means the example is documented if it is still appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.