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

Instruction

Perfect! Of course, just like ordinary variables, vectors can also contain strings, not just numbers. When a vector contains strings, we call it a character vector.

You can create a character vector with the c() function, just as you did for  numeric vectors. The only difference is that your elements now need to be surrounded in single or double quotation marks because they are strings, like so:

c("Mary", "John", "Tim", Alex", "Kim", "Stuart")

Let's create a vector named name that stores the names of Versico's top five employees with the highest salaries:

names <- c("Tim Pearson", "John Smith", "Emma Stone", "Ana Kovach", "Mia Balicki")

Exercise

Create a vector named job_positions with the following elements: Senior data analyst, Customer support specialist, Senior Java Developer. These are the job positions of Versico's top three employees. Don't forget to surround each string with single or double quotes.