Session Ready
Exercise

Character vectors

As in the previous question, we are going to create a vector. Only this time, we learn to create character vectors. The main difference is that these have to be written as strings and so the names are enclosed within double quotes.

A character vector would look something like this:

food <- c("pizza", "burgers", "salads", "cheese", "pasta")
Instructions
100 XP

The temperatures we stored in temp are from the cities Beijing, Lagos, Paris, Rio de Janeiro, San Juan, and Toronto.

  • Create a vector with these city names and call the object city. Make sure to use the correct order, spelling and capitalization!
  • (Also note that DataCamp is not compatible with the punctuation used on an iPad or some mobile phones. Complete DataCamp exercises on a full-size computer to avoid correct answer rejections.)