I am beginner in R and data analysis.I have a data-set of around 2500 rows with 7 columns .I want to cluster the data-set with 15 centers but on the basis of just first two columns(keeping other columns intact with the clustered-data-set.
I also need to display the clustered data-set sorted on the basis of a third column.
Can someone help me with the required syntax ? let my csv file name be locdata.csv and first two columns be "lat" and "lon" and third column be "date".
This should help you get there.
First create the dataset (alternatively, import the csv file):
Next you can extract the clusters, using the fact that the kmeans retains the original order: