Bar charts are more general than histograms, and they can represent both discrete and continuous data. They can even be used to represent categorical variables. A bar chart uses a horizontal or vertical rectangular bar that levels of at an appropriate level. A bar chart can be used to represent various quantities, such as frequency counts and percentages.
We will use the weather description data to create a bar chart. To create a bar chart, the geometric object used is geom_bar().
The syntax is as follows:
ggplot(….) + geom_bar(…)
If we use the glimpse or str command to view the weather data, we will get the following results: