K-means cluster plot
Question
Suppose you have the following dataset which contains (1st tab) a list of items purchased by a given user, (2nd tab) a mapping which maps the item_id to the item name and price, (3rd tab) a matrix that formats data from sheet 1 into a matrix with users in rows and the number of each item_id purchased in columns.
With this data, we want to see if we can cluster types of groceries that are typically purchased together. In a previous question, for this data set, we wanted to build plots to look at n=3, 5, and 7. Knowing this, can you create a function that allows us to input the number of clusters and returns a plot with the potential clusters using Principal Component Analysis (PCA)?