我有以下创建可折叠树的数据:
注意我将参数从它们的原始字段切换到 c1、c2、c3、c4,它们是所涉及的列
rm(list=ls())
library('rsconnect')
library(flexdashboard)
library(dplyr)
library(collapsibleTree)
library(rsconnect)
df <- read.csv("Tree.csv")
require(data.tree)
require(collapsibleTree)
df %>%
group_by('C1','C2','C3','C4') %>%
summarize(`Count` = n()) %>%
collapsibleTreeSummary(
hierarchy = c('C1','C2','C3','C4'),
root = "Find my Size",
linkLength = 200.0,
attribute = "Count",
percentOfParent = TRUE,
nodeSize = "Count",
fontSize = 12.0,
tooltip = TRUE
)
我得到以下输出:
我想让可折叠树同时显示父项的百分比和总计数——但是,如果我percentofParent
设置为 true,计数就会消失。我使用了该collapsibleTreeSummary
功能,但我查看了文档并没有找到解决方案。