Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 各组的聚类分析 这是一份带有记分卡的人员列表(Z) 种子(10) df%排列(X,Y) df1_R_Data Mining_Data Manipulation - Fatal编程技术网

R 各组的聚类分析 这是一份带有记分卡的人员列表(Z) 种子(10) df%排列(X,Y) df1

R 各组的聚类分析 这是一份带有记分卡的人员列表(Z) 种子(10) df%排列(X,Y) df1,r,data-mining,data-manipulation,R,Data Mining,Data Manipulation,(df1>其首字母为图像) 在每个组(女性毕业生、女性非毕业生、男性毕业生、男性非毕业生)中,我们都希望创建集群。最后,我们需要给每个人一个唯一的集群id。这意味着输出文件是一个clusterid数组。试试看 Here is a list of persons with their scorecards(Z) set.seed(10) df <- data.frame(X = sample(c("Male", "Female"), 40, replace = TRUE),Y= sampl

(df1>其首字母为图像)

在每个组(女性毕业生、女性非毕业生、男性毕业生、男性非毕业生)中,我们都希望创建集群。最后,我们需要给每个人一个唯一的集群id。这意味着输出文件是一个clusterid数组。

试试看

Here is a list of persons with their scorecards(Z)
set.seed(10)
df <- data.frame(X = sample(c("Male", "Female"), 40, replace = TRUE),Y= sample    (c("Graduate", "Non-graduate"), 40, replace  = TRUE),Z =10*runif(40))
library(dplyr)
df1 <- df %>% group_by(X,Y) %>% arrange(X,Y)
df1

hc您有什么问题,您尝试了什么?请不要交叉张贴:重复于
hc <- hclust(dist(scale(data.matrix(df1))))
plot(hc)
View(newdf <- cbind(df1, cluster=cutree(hc, h = 0.5)))