R-kmeans
data <- read.csv("//Users//tangjingxiao//Desktop//2.csv",header=T,sep="\t",encoding="utf-8") data fix(data) View(data) newdata <- t(data) view(newdata) View(newdata) kc <- kmeans(newdata,30) kc plot(newdata,col=kc$cluster) points(kc$centers, col = 1:2, pch = 8, cex = 2) ss <- function(y) sum(scale(y, scale = FALSE)^2) ss ## cluster centers "fitted" to each obs.: fitted.newdata <- fitted(kc); head(fitted.newdata); resid.newdata<- newdata - fitted(kc); resid