From the course: Data Science Foundations: Data Mining in R

Unlock the full course today

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

Solution: K-means

Solution: K-means

From the course: Data Science Foundations: Data Mining in R

Start my 1-month free trial

Solution: K-means

(upbeat music) - [Instructor] When I extended this challenge to you, I invited you to use the iris data to do k-means clustering with a value of three for k because there are three different species of iris. Let me show you how I solved this, and you can compare your own answers. Now, not surprisingly, this one follows the example we had very closely of k-means clustering earlier. So in fact, I'm going to be loading the same packages here, including car for the scatterplotMatrix, cluster, datasets, and so on. And once those are loaded, I'm going to come down and get the iris dataset. I'm going to set the random seed because that can work into things, and I'll save the iris dataset to df as a tibble, so I've got it over there in my environment. We'll check the data quickly. There we have the four physical measurements and the Species class variable there at the end. Now, I'm going to separate the class variable. I'm…

Contents