Relative Frequency Distribution of Qualitative Data
The relative frequency distribution of a data variable is a summary of the frequency proportion in a collection of non-overlapping categories.
The relationship of frequency and relative frequency is:
In the data set painters, the relative frequency distribution of the School variable is a summary of the proportion of painters in each school.
Find the relative frequency distribution of the painter schools in the data set painters.
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 find the sample size of painters with the nrow function, and divide the frequency distribution with it. Therefore the relative frequency distribution is:
The relative frequency distribution of the schools is:
A B C D E F
0.185185 0.111111 0.111111 0.185185 0.129630 0.074074
We can print with fewer digits and make it more readable by setting the digits option.
A B C D E F G H
0.19 0.11 0.11 0.19 0.13 0.07 0.13 0.07
In addition, we can apply the cbind function to print the result in column format.
> options(old) # restore the old option
Find the relative frequency distribution of the composition scores in painters.