1.3 Vectors

Create a vector called "v1" containing four values, in this order- 2, 9, 3, 4.5.

v1 = c(2, 9, 3, 4.5)


Find the length of v1

length(v1)


Create a vector called "v2" containing four values, in this order- 15, 4, 8, 10

v2 = c(15, 4, 8, 10)


Combine the v1 and v2 vectors into one vector of length 8, assigning the result to v3

v3 = c(v1, v2)


Find the mean of v3

mean(v3)


Extract the third value from v3

v3[3]