Bar Graph
A bar graph of a qualitative data sample consists of vertical parallel bars that shows the frequency distribution graphically.
Example
In the data set painters, the bar graph of the School variable is a collection of vertical bars showing the number of painters in each school.
Problem
Find the bar graph of the painter schools in the data set painters.
Solution
We first apply the table function to compute the frequency distribution of the School variable.
> school = painters$School # the painter schools
> school.freq = table(school) # apply the table function
Then we apply the barplot function to produce its bar graph.
Answer
The bar graph of the school variable is:
Enhanced Solution
To colorize the bar graph, we select a color palette and set it in the col argument of barplot.
+ "orange", "blue", "pink", "cyan")
> barplot(school.freq, # apply the barplot function
+ col=colors) # set the color palette
Exercise
Find the bar graph of the composition scores in painters.