## • factoextra » [Solved] fviz_cluster(): Visualizing Clusters with PC3 and PC4

I am using your great package 'fviz_cluster' to visualize my cluster partition object obtained from 'CLARA' over PC1 (dim1) and PC2(dim2). But I want to visualize it with PC3 and PC4 as well. I tried using the argument 'choose.vars= c(PCA$scores[,"Comp.3"],PCA$scores[,"Comp.4"])' where PCA is my princomp object and PCA$scores[,"Comp.3"] is the PC3 scores for each of my observations in my dataset. However, I get an error message.

"Error in data[, choose.vars, drop = FALSE] :

only 0's may be mixed with negative subscripts"

I can't understand this error. Could you please help me visualize my cluster solution with PC3(dim3) and PC4(dim4)?

Code R :

library(cluster) library(factoextra) res.clust <- clara(iris[, -5], k = 3 ) fviz_cluster(res.clust, axes = c(3, 4))

The output looks like this:

Answer

You aren't allowed to write in this category