Clustering on R? HELP!

Hi everyone, first post on here.
I have to do an assignment for my Uni class.
Our database has different columns (Age(in groups : 0-17 ecc),gender(F,M),marital_status(1,0), City Category (A-B-C), Stay in city (1-2-3-4+), Product Category 1(numeric with NA), product category 2 and 3 same as 1, and purchase amount in $, Product ID and User ID that are alpha-numeric.

We need to do clustering and it being a big database I suppose I require k-means.

How can I do it? I used this code, hope to get some help :
preproc = preProcess(BlackFriday)
BlackFriday.norm = predict(preproc, BlackFriday)
kmeansClust = kmeans(BlackFriday.norm, centers=4, iter.max=1000)
BlackFriday.norm$Product_ID= NULL
BlackFriday.norm$Product_ID = NULL
BlackFriday.norm$Gender = NULL
BlackFriday.norm$Age = NULL
BlackFriday.norm$City_Category = NULL
BlackFriday.norm$Stay_In_Current_City_Years = NULL
BlackFriday.norm$User_ID = NULL
kmeansClust = kmeans(na.omit(BlackFriday.norm), centers=4, iter.max=1000)
KMeansClusterGroups = kmeansClust$cluster
tapply(na.omit(BlackFriday.norm)$Product_Category_1, KMeansClusterGroups, mean)
tapply(na.omit(BlackFriday.norm)$Product_Category_2, KMeansClusterGroups, mean)
tapply(na.omit(BlackFriday.norm)Product_Category_3, KMeansClusterGroups, mean) tapply(na.omit(BlackFriday.norm)Purchase amount in $, KMeansClusterGroups, mean)
tapply(na.omit(BlackFriday.norm)$Marital_Status, KMeansClusterGroups, mean)
tapply(na.omit(BlackFriday.norm)$Occupation, KMeansClusterGroups, mean)

Thank you in advance!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.