我有一个 FAMD 和以下代码来可视化我的数据样本的结果。我使用生成基于 ggplot2 的可视化的包“factoextra”。过去它运行良好(见下图链接)。现在我重新计算/替换了一个变量以放入我的 FAMD 中,我无法再根据“习惯”进行着色了。我所有其他的可视化都不受影响。我收到以下错误消息:
.add_ind_groups(X, df, habillage) 中的错误:活跃个体的数量与因子 habillage 的长度不同。请删除变量 habillage 中的补充个体。
我不明白为什么它要我删除“补充个体”,因为它曾经有效,并且它说“habillage 还可以指定补充定性变量(通过其索引或名称)用于按组着色个体”。
我想根据我的补充变量 org_con 可视化我的数据。
grp <- sample$org_con # org_con is my supplementary variable, sample are 5000 random points from my data set
options(ggrepel.max.overlaps = 1000)
graph.individ <- fviz_famd_ind(res.famd.samp, # for visualisation purposes I ran my FAMD with the same sample that I use to create "grp"
habillage = grp, # if I exclude this line I get a plot though it is not grouped (see link to image below)
addEllipses = TRUE,
repel = TRUE,
label = "none",
alpha.ind = 0.5,
)
graph.individ
这就是以前的结果: 带有按补充变量“org_con”分组的点的绘图图像
现在,除了“habillage”,我只能像这样想象它: image of plot with points ungrouped