christophergandrud / christophergandrud/networkD3

2-column source->target dataframe to link and node lists?

Open
#246 1 comment 0 reactions 0 assignees View on GitHub
enhancement feature request forceNetwork simpleNetwork
Dominant language
R
Stars
659
Forks
259
PR merge metrics
No merged PRs in 30d

Description

Is there a native munging function for getting a 2-column (source->target) data.frame into a link list and node list format?

The 2-column dataframe has the following format

| Source | Target |
|--------|--------|
| A | C |
| A | D |
| B | E |
| B | F |

The link list would be:

| from | to |
|------|----|
| 0 | 2 |
| 0 | 3 |
| 1 | 4 |
| 1 | 5 |

and the node list would be

| id | node |
|----|------|
| 0 | A |
| 1 | B |
| 2 | C |
| 3 | D |
| 4 | E |
| 5 | F |

I can get the data into this format but I want to know if there are standard methods for doing so?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.