course content

Course Content

R Introduction: Part I

SummarySummary

If you're looking to count the occurrences of each value within a vector, the summary() function is precisely what you need.

To tally the frequency of each level within a factor, invoke the summary() function with the factor as its argument. This will enumerate the occurrences for each level that the factor can take. For instance:

Remember, the sequence of the levels reported by summary() corresponds to the order defined when you employed the factor() function (without a defined order, it defaults to numerical order or alphabetical order).

Task

For the grades data mentioned earlier compute the frequency of each grade within the grades_f factor.

Everything was clear?

Section 3. Chapter 4
toggle bottom row