Created
September 16, 2013 17:06
-
-
Save randyzwitch/6583506 to your computer and use it in GitHub Desktop.
kmeans guessing at 5 main clusters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#I think there are 5 main topics: Data Science, Web Analytics, R, Julia, Wordpress | |
kmeans5<- kmeans(dtm, 5) | |
#Merge cluster assignment back to keywords | |
kw_with_cluster <- as.data.frame(cbind(searchkeywords$'Natural Search Keyword', kmeans5$cluster)) | |
names(kw_with_cluster) <- c("keyword", "kmeans5") | |
#Make df for each cluster result, quickly "eyeball" results | |
cluster1 <- subset(kw_with_cluster, subset=kmeans5 == 1) | |
cluster2 <- subset(kw_with_cluster, subset=kmeans5 == 2) | |
cluster3 <- subset(kw_with_cluster, subset=kmeans5 == 3) | |
cluster4 <- subset(kw_with_cluster, subset=kmeans5 == 4) | |
cluster5 <- subset(kw_with_cluster, subset=kmeans5 == 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment