R
htmlwidget for inspecting heirachal structures with
the ‘jQuery’ ‘jsTree’ Plugin.
#install.packages('jsTree')
::install_github('yonicd/jsTree') remotes
library(jsTree)
data(states)
data(state_bird)
collapse columns to text (with sep “/”)
<- apply(states,1,paste,collapse='/')
nested_string jsTree(nested_string)
Add tooltips to state names with the state bird
jsTree(nested_string,tooltips = state_bird)
initialize tree with checked boxes for certain fields
<- states$variable=='Area'
nodestate1 jsTree(nested_string,nodestate=nodestate1)
<- states$variable=='Area'&grepl('^M',states$state.name)
nodestate2 jsTree(nested_string,nodestate=nodestate2)
<- states$variable %in% c('Murder') & states$value >= 10
nodestate3 <- states$variable %in% c('HS.Grad') & states$value <= 55
nodestate4 jsTree(nested_string,nodestate=nodestate3|nodestate4)
change the order of the hierarchy
<- apply(states[,c(4,1,2,3,5)],1,paste,collapse='/')
nested_string2 jsTree(nested_string2)
Use other delimiters to define the heirarchy
<- apply(states,1,paste,collapse='|-|')
nested_string jsTree(nested_string,sep = '|-|')
::install_github('yonicd/vcs')
remotes
#get repo master branch directory structure
::navigate_remote('tidyverse/ggplot2') vcs