Creating character vectors

1:100
c(1, 2, 3, 4)
c("abc", "def", "ghi")
c(TRUE, FALSE, TRUE)
View Interactive Version

To create a character vector of one element, all we need to do is to type out the text. Remember that we need to use quotation marks (" ") around character values:

Input
"golden retriever"
Output
[1] "golden retriever"

To create a character vector of multiple elements, we can again use the concatenate function c(). This time we will use it with characters instead of numbers:

Input
c("golden retriever", "labrador is a family dog", "beagle")
Output
[1] "golden retriever"         "labrador is a family dog"
[3] "beagle"                  
Combine values into a vector