https://github.com/yonicd/jstree
R htmlwidget for inspecting heirachal structures with the ‘jQuery’ ‘jsTree’ Plugin.
https://github.com/yonicd/jstree
htmlwidgets jquery-plugin r
Last synced: 7 months ago
JSON representation
R htmlwidget for inspecting heirachal structures with the ‘jQuery’ ‘jsTree’ Plugin.
- Host: GitHub
- URL: https://github.com/yonicd/jstree
- Owner: yonicd
- License: other
- Created: 2017-05-31T15:12:46.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-12T18:05:38.000Z (over 5 years ago)
- Last Synced: 2025-01-13T08:11:55.909Z (over 1 year ago)
- Topics: htmlwidgets, jquery-plugin, r
- Language: HTML
- Homepage: https://yonicd.github.io/jsTree/
- Size: 48.3 MB
- Stars: 31
- Watchers: 7
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
always_allow_html: yes
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "tools/readme/README-",
echo = TRUE
)
```
[](https://cran.r-project.org/package=jsTree)
[](https://www.repostatus.org/#active)

[](https://github.com/yonicd/jsTree/actions)
[](https://github.com/yonicd/jsTree/actions)
[](https://codecov.io/github/yonicd/jsTree?branch=master)
# jsTree
`R` htmlwidget for inspecting heirachal structures with the 'jQuery' 'jsTree' Plugin.
```{r,include=FALSE}
knitr::opts_chunk$set(eval = FALSE)
```
## Installation
```{r,eval = FALSE}
#install.packages('jsTree')
remotes::install_github('yonicd/jsTree')
```
## Conventional Use
```{r}
library(jsTree)
data(states)
data(state_bird)
```
collapse columns to text (with sep "/")
```{r}
nested_string <- apply(states,1,paste,collapse='/')
jsTree(nested_string)
```
Add tooltips to state names with the state bird
```{r}
jsTree(nested_string,tooltips = state_bird)
```
initialize tree with checked boxes for certain fields
```{r}
nodestate1 <- states$variable=='Area'
jsTree(nested_string,nodestate=nodestate1)
```
```{r}
nodestate2 <- states$variable=='Area'&grepl('^M',states$state.name)
jsTree(nested_string,nodestate=nodestate2)
```
```{r}
nodestate3 <- states$variable %in% c('Murder') & states$value >= 10
nodestate4 <- states$variable %in% c('HS.Grad') & states$value <= 55
jsTree(nested_string,nodestate=nodestate3|nodestate4)
```
change the order of the hierarchy
```{r}
nested_string2 <- apply(states[,c(4,1,2,3,5)],1,paste,collapse='/')
jsTree(nested_string2)
```
Use other delimiters to define the heirarchy
```{r}
nested_string <- apply(states,1,paste,collapse='|-|')
jsTree(nested_string,sep = '|-|')
```
## Interacting with remote repositories
### Preview a github repo without cloning it
```r
remotes::install_github('yonicd/vcs')
#get repo master branch directory structure
vcs::navigate_remote('tidyverse/ggplot2')
```

### Search text in files of a repo without cloning it
