SummarySummary

Good! Now let's solve another problem: what if we want to count the number of each value in a vector?

You can easily solve this by using the summary() function with the factor variable as the parameter. This will return the number of occurrences of each possible value in the factor. For example,

Note that the order of possible values is the same order that you set within the factor() function (if you don't set the order, then math laws or alphabet work)

Task

Given the same grades data from the previous chapter, count the number of each grade in the grades_f variable.

Everything was clear?

Section 3. Chapter 4
toggle bottom row