sunburstR图的data.frame结构问题

时间:2017-04-06 13:01:55

标签: r sunburst-diagram htmlwidgets

你好,

我根据sunburstR文档中的示例创建了下面的数据框。

                         Column Count 
 1:                      ACTIVE 68764
 2:                    INACTIVE 73599
 3:             ACTIVE-RESIDENT 68279
 4:          ACTIVE-NONRESIDENT   485
 5:           INACTIVE-RESIDENT 63378
 6:        INACTIVE-NONRESIDENT 10221
 7:       ACTIVE-RESIDENT-LATIN    55
 8:      ACTIVE-RESIDENT-CYRLIC 68224
 9:    ACTIVE-NONRESIDENT-LATIN   465
10:   ACTIVE-NONRESIDENT-CYRLIC    20
11:     INACTIVE-RESIDENT-LATIN   114
12:    INACTIVE-RESIDENT-CYRLIC 63264
13:  INACTIVE-NONRESIDENT-LATIN  7915
14: INACTIVE-NONRESIDENT-CYRLIC  2306

第一列是字符,第二列是整数。

然而,当我试图绘制它时,我什么都没得到。

sunburst(sunburst_data)

我的数据框架结构有什么提示吗?

1 个答案:

答案 0 :(得分:0)

仅在数据框中包含叶节点...

df <- read.table(text = '
Column Count 
ACTIVE-RESIDENT-LATIN    55
ACTIVE-RESIDENT-CYRLIC 68224
ACTIVE-NONRESIDENT-LATIN   465
ACTIVE-NONRESIDENT-CYRLIC    20
INACTIVE-RESIDENT-LATIN   114
INACTIVE-RESIDENT-CYRLIC 63264
INACTIVE-NONRESIDENT-LATIN  7915
INACTIVE-NONRESIDENT-CYRLIC  2306
')

library(sunburstR)
sunburst(df)