O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

Perform the following steps to partition using medoids approach:

  1. First, compute pam with k = 4 on the scaled data frame and check the medoids:
>pamFit <- pam(proteinIntakeScaled, 4)> pamFit$medoids

The output of the preceding command:

  1. Now plot the result:
> fviz_cluster(pamFit)

The following diagram gives a visualization of the results:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required