Given a root absolute directory path. How do I generate a dendrogram object of all path\'s below it so that I can visualize the directory tree with R?
Suppose the fo
If you are on Windows, you can use my package dir2json, by installing it like this:
drat::addRepo("stlarepo")
install.packages("dir2json")
It is also possible to use it on Linux, but there is a DLL linked to the GHC dynamic libraries, which must be installed on the system (while this DLL is standalone on Windows).
> library(dir2json)
> cat(dir2tree("src"))
src
|
`- contrib
|
+- PACKAGES.gz
|
+- PACKAGES
|
+- jsonAccess_0.1.1.tar.gz
|
+- expansions_1.2.tar.gz
|
`- dir2json_2.1.0.tar.gz
> cat(dir2tree("src", vertical=TRUE))
src
|
contrib
|
---------------------------------------------------------------------------
/ | | | \
PACKAGES.gz PACKAGES jsonAccess_0.1.1.tar.gz expansions_1.2.tar.gz dir2json_2.1.0.tar.gz
The package also contains a Shiny application which generates an interactive Reingold-Tilford tree representation of a folder:
> dir2json::shinyDirTree(".")