【问题标题】:Trying to display the value of a column in a clusplot chart using R [duplicate]尝试使用 R [重复] 在 clusplot 图表中显示列的值
【发布时间】:2016-02-11 16:03:50
【问题描述】:

我正在使用 Power Bi 中的 R 并显示一个 Clusplot 图表 - 工作正常。

但是如何将 column1 显示为集群中的标签,而不是数字 (1-27)。

这是我的代码:

library(cluster)
D=daisy(dataset, metric='gower')
H.fit <- hclust(D, method="ward")
plot(H.fit)
groups <- cutree(H.fit, k=5, tree) # cut tree into 4 clusters
rect.hclust(H.fit, k=3, border="red") 
clusplot(dataset, groups, color=TRUE, shade=TRUE, lines=0, main= 'Customer segments', span=F, labels=2)

【问题讨论】:

    标签: r cluster-analysis powerbi


    【解决方案1】:

    使用row.names

    如果您的行没有名称,它们将使用行号。

    【讨论】:

    • 太棒了 - 它使用以下命令:row.names(dataset)
    猜你喜欢
    • 1970-01-01
    • 2018-08-14
    • 2017-10-05
    • 1970-01-01
    • 1970-01-01
    • 2018-01-05
    • 2015-06-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多