The combine or c() function in R is used to create vectors by combining multiple values.
c() Function Syntax
c(value1, value2, …)
Example 1: Creating a Numeric Vector
#creating a vector and storing it in variable x
x <- c(9,8,7,6,5)
x
Output
[1] 9 8 7 6 5
Example 2: Vector inside Vector
#creating a vector and storing it in variable x
x <- c(9,8,7,6,5)
#creating another vector and storing it in variable y
y <- c(x,5,4,3,2,1,0)
y
Output
[1] 9 8 7 6 5 5 4 3 2 1 0