From the course: R Essential Training Part 2: Modeling Data

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Grouping cases with k-means clustering

Grouping cases with k-means clustering

From the course: R Essential Training Part 2: Modeling Data

Start my 1-month free trial

Grouping cases with k-means clustering

- [Instructor] When you're looking for clusters in your data, the cases or the people that are similar to each other, sometimes you actually know how many groups there should be. How many you already have various campaigns prepared for, or how many categories you can accommodate. In that case, you don't want to use a hierarchical method, which goes all the way from one giant group to everybody in their own group. But you want to use something like K means clustering. And what this means is, you select a number, that's the K, that indicates a previously chosen number of clusters that you want. This is a really easy to-do approach and I'm going to run through this by first loading a few packages, including cluster and then we're going to use a data set from the built in R dataset called MT cars. And what this is, is Motor Trend magazine doing car testing back in 1974. And it has 32 observations, so 32 cars and this is the…

Contents