https://github.com/stla/dir2json
JSON representation of hierarchical data, such as a directory structure
https://github.com/stla/dir2json
d3 json r shiny-applications
Last synced: 15 days ago
JSON representation
JSON representation of hierarchical data, such as a directory structure
- Host: GitHub
- URL: https://github.com/stla/dir2json
- Owner: stla
- Created: 2017-02-24T18:08:55.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-05-20T20:45:59.000Z (almost 3 years ago)
- Last Synced: 2024-11-27T11:38:53.699Z (3 months ago)
- Topics: d3, json, r, shiny-applications
- Language: Less
- Homepage:
- Size: 5.42 MB
- Stars: 7
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - stla/dir2json - JSON representation of hierarchical data, such as a directory structure (Less)
README
# dir2json, an R package
Originally, this package only dealt with the hierarchical data given by
the structure of a folder, but now it can deal with any dataset with a
hierarchical structure.
It provides a Shiny application (see below).
Also provides a function to get the tree view of a directory.This package uses the DLL created by the Haskell libraries [jsondirtree](https://github.com/stla/jsondirtree) and [jsondirtreeR](https://github.com/stla/jsondirtreeR). They are standalone on
Windows.```r
library(dir2json)
dat <- tibble::tribble(
~level1, ~level2, ~level3, ~level4,
"Beverages", "Water", "", "",
"Beverages", "Coffee", "", "",
"Beverages", "Tea", "Black tea", "",
"Beverages", "Tea", "White tea", "",
"Beverages", "Tea", "Green tea", "Sencha",
"Beverages", "Tea", "Green tea", "Gyokuro",
"Beverages", "Tea", "Green tea", "Matcha",
"Beverages", "Tea", "Green tea", "Pi Lo Chun"
)
shinyDataTree(dat, root = FALSE)
```
This kind of tree is called a *Reingold-Tilford tree network diagram*. It
is produced with the help of **D3.js**.