https://github.com/robinl/hierarchical_bubble_r_html_widget
An HTML widget for R that displays hierarchical data in a nested bubble chart
https://github.com/robinl/hierarchical_bubble_r_html_widget
Last synced: 8 months ago
JSON representation
An HTML widget for R that displays hierarchical data in a nested bubble chart
- Host: GitHub
- URL: https://github.com/robinl/hierarchical_bubble_r_html_widget
- Owner: RobinL
- License: other
- Created: 2017-04-29T15:59:45.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-30T09:10:05.000Z (about 9 years ago)
- Last Synced: 2025-01-17T05:44:40.721Z (over 1 year ago)
- Language: JavaScript
- Size: 85.9 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
title: "README"
author: "Robin Linacre"
date: "30 April 2017"
output: md_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Hierarchical bubble
A zoomable, pannable hierarchical bubble chart HTML Widget for R implemented in d3v4.
This is work in progress, but you can find a working example of a Shiny app [within the repo](https://github.com/RobinL/hierarchical_bubble_r_html_widget/blob/master/example.R).
## Instructions
The widget expects data in the following format (showing first few rows only):
```{r, echo=FALSE}
df <- hierarchicalbubble::generate_test_data()[1:2,]
names <- paste0("cat_", 1:4)
df_l <- hierarchicalbubble::wide_to_long_hierarchy(df,names, "val")
knitr::kable(df_l, options=list(scrollX = TRUE))
```
However, you're more likely to have data that looks like this (first few rows only):
```{r, echo=FALSE}
df <- hierarchicalbubble::generate_test_data()[1:3,]
knitr::kable(df)
```
So a convenience function is provided that converts between the two:
```{r, eval=FALSE}
df <- hierarchicalbubble::generate_test_data()[1:5,]
names <- paste0("cat_", 1:4)
df_l <- hierarchicalbubble::wide_to_long_hierarchy(df,names, "val")
```
To see your visualisation use
```{r, eval=FALSE}
hierarchicalbubble::hierarchical_bubble(df_l)
```
Here's a screenshot of the widget embedded in a Shiny app:
