Vector is a type of object or data structure in R-language. They are designed to store multiple values of same data-type. For example: if you want to store different 50 food items for each cuisine, you don't need to create 50 variables for each cuisine but just a vector of length 50 of datatype character.
Note: It can not have a combination of any two datatype. It has to be homogeneous in nature.
This recipe demonstrates how to create a raw vector
We use combine function "c()" to create a vector
Case 1: Vector food_items with data of 3 different cuisine of character datatype
food_items = c("pasta", "burrito", "butter chicken") class(food_items)
Case 2: Vector no_of_children with data of 3 different people of numeric datatype
no_of_children = c(0,2,3) class(no_of_children)
Case 3: Vector that has both character and numeric values
mixed_values = c(1,3,'red') class(mixed_values)
We can see that the numeric values are type casted to character in this case and the homogeinity is maintained