i have this error when i try to use kmeans() function Error in sample.int(m, k) : invalid first argument ...what's the problem
km<-kmeans(df,4)
i have this error when i try to use kmeans() function Error in sample.int(m, k) : invalid first argument ...what's the problem
km<-kmeans(df,4)
I would compare the format of df
to the format of x
in the example given in ?kmeans
:
x <- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2))
colnames(x) <- c("x", "y")
(cl <- kmeans(x, 2))
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.