-
Book Overview & Buying
-
Table Of Contents
Applied Unsupervised Learning with R
By :
Solution:
Download mushrooms.csv from https://github.com/TrainingByPackt/Applied-Unsupervised-Learning-with-R/blob/master/Lesson02/Activity05/mushrooms.csv.
After downloading, load the mushrooms.csv file in R:
ms<-read.csv('mushrooms.csv')Check the dimensions of the dataset:
dim(ms)
The output is as follows:
[1] 8124 23
Check the distribution of all columns:
summary.data.frame(ms)
The output is as follows:

Figure 2.29: Screenshot of the summary of distribution of all columns
Each column contains all the unique labels and their count.
Store all the columns of the dataset, except for the final label, in a new variable, ms_k:
ms_k<-ms[,2:23]
Import the klaR library, which has the kmodes function:
install.packages('klaR')
library(klaR)Calculate kmodes clusters and store them in a kmodes_ms variable. Enter the dataset without true labels as the first parameter and enter the number of clusters as...
Change the font size
Change margin width
Change background colour