Response: If we look at the dataset, the frequency of distribution has to be plotted as a histogram with the help of the ggplot2 library in R. We can consider “cut” parameter which categorizes required information. When we use the “table” command, then we can get an idea of a number of records, whether there are missing values (here, in this case, there are no missing values) and henceforth it can be used to plot the histogram chart. We can use the geom_bar function and using “cut” parameter in the x-axis to display the necessary information as per below. library(ggplot2)
attach(diamonds)
str(diamonds)
ggplot(data = diamonds)+geom_bar(mapping = aes(x = cut)) We see that desired plot is represented and we are also able to validate values at a high level based on the “table” command that we had used to get an understanding of the distribution of the data information.