Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
What are vectors?
Vector operations
Indexing and filtering
Simple analysis
Summary

Instruction

Nicely done! We've seen that you can use the summary() function when dealing with numeric columns. If you have a character column, though, finding a minimum or maximum value does not make sense. However, you may want to count the occurrence of a certain value for each category.

For example, we want to find the number of employees that know a given foreign language. We can calculate it with the table() function, like this:

table(known_languages)

With this expression, R will count the number of occurrences of each value from the known_languages vector:

Polish  French  German  Japanese
     4       5       3         1

You will use table() quite often. Try it yourself in the exercise!

Exercise

If you know that the vector job_positions stores the position of every employee at the Versico company, you can find the number of employees that work at a given post.

Display a frequency table for the job_positions vector. Use the table() function.