I need to cluster some data and I tried kmeans
, pam
, and clara
with R.
The problem is that my data are in a column of a data frame, and contains NAs.
I used na.omit()
to get my clusters. But then how can I associate them with the original data? The functions return a vector of integers without the NAs and they don't retain any information about the original position.
Is there a clever way to associate the clusters to the original observations in the data frame? (or a way to intelligently perform clustering when NAs are present?)
Thanks