Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Counting Factor Values | Factors
R Introduction

bookCounting Factor Values

You can count how many times each category appears in a factor using the summary() function.

Example

12345
curr_f <- factor(c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR')) # Count the occurrences of each level summary(curr_f)
copy

The output lists each level with the number of times it occurs. This makes it easy to see the distribution of categories in your data.

Note
Note

The order in which results appear corresponds to the order of levels in the factor.

Task

Swipe to start coding

Compute the frequency of each grade within the grades_f factor.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 4
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

Awesome!

Completion rate improved to 2.27

bookCounting Factor Values

Swipe to show menu

You can count how many times each category appears in a factor using the summary() function.

Example

12345
curr_f <- factor(c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR')) # Count the occurrences of each level summary(curr_f)
copy

The output lists each level with the number of times it occurs. This makes it easy to see the distribution of categories in your data.

Note
Note

The order in which results appear corresponds to the order of levels in the factor.

Task

Swipe to start coding

Compute the frequency of each grade within the grades_f factor.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 4
single

single

some-alt