'Need help Visualizing predefined Kmeans Clustering in R

I am giving you just an example here, but I have a dataset containing 300 observations and 10 attributes on which I did kmeans clustering. I have done the kmeans with 2 clusters and got the final result in a table as follows:

enter image description here

I am new to R. So the thing is that I wanted to visualize the results of clustering I got but I am not sure how to do it. This is where I stored my final table:

final <- rbind(client_data, visitor_data)

I tried this:

fviz_cluster(clusters, final[, -5], ellipse.type="norm")
final_resu <- final_resu  |> mutate(cluster= clusters$cluster)
final_resu |> ggplot (aes(x = cluster, y= x_ID, col= as.factor(cluster))) + geom_point()

But I am not really sure of it and got error in ggplot



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source