summarytrees_htmlwidget

本文介绍了一个基于 R 语言包 summarytrees 的 HTML 小部件,该小部件用于创建和可视化最大熵摘要树。此项目处于开发阶段,可通过 devtools::install_github 安装。文章感谢了作者 Kenneth Shirley 的研究与实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I feel obligated to mention this again. If you want to get a preview of the exciting changes for htmlwidgets, be sure to check out htmlwidgets issue 86. Thanks to Joe Cheng from RStudio for taking the lead on this.

We can see some early examples with plotly from early adopter Andrew Clark @pssguy.

This Week’s Widget - summarytrees_htmlwidget

Kenneth Shirley and Howard Karloff authored an interesting paper.

(2013). Howard Karloff and Kenneth E. Shirley. “Maximum Entropy Summary Trees”, Computer Graphics Forum (Proc. EuroVis), Volume 32, Issue 3, Part 1, pp. 71-80.

Subsequently, Kenny made an R package summarytrees to create and visualize these summary trees. I learned about the R/d3.js combination after Kenny’s presentation at JSM 2015. Similar to the htmlwidget conversions of stmBrowser and stmCorrViz, I thought summarytrees would also be a great candidate for an htmlwidget.

This is a work in progress. Please offer feedback and ideas on this Github issue.

Installation

This is not on CRAN and only exists in a summarytrees fork, so to install we will need some help from devtools::install_github.

devtools::install_github("timelyportfolio/summarytrees@htmlwidget")

Examples

# devtools::install_github("timelyportfolio/summarytrees@htmlwidget")

library(summarytrees)
data(dmoz)

#use example from vignette
K <- 100
g <- greedy(node = dmoz[, "node"],
           parent = dmoz[, "parent"],
           weight = dmoz[, "weight"],
           label = dmoz[, "label"],
           K = K)

# Prepare the summary trees for visualization:
json <- prepare.vis(tree.list = g$summary.trees,
                    labels = g$data[, "label"],
                    tree = g$tree,
                    legend.width = 150,
                    node.width = 225,
                    node.height = 14,
                    units = "# of URLs",
                    print.weights = TRUE,
                    legend.color = "lightsteelblue",
                    color.level = 3)
summarytrees_htmlwidget(json)
## [1] "Running order.nodes() function to prepare data"
## [1] "  Computing node levels"
## [1] "  Computing child indices for each parent"
## [1] "Running C function to compute summary trees"
## [1] "Computation finished; now formatting output"

Thanks

Thanks Kenneth Shirley for the research and implementation of summarytrees.

As always, thanks to

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值