[For this exercise, first write down your answer, without using R. Then, check your answer using R.]

Answers to the exercises are available here.

**Exercise 1**

Consider two vectors, `x, y`

`x=c(4,6,5,7,10,9,4,15)`

`y=c(0,10,1,8,2,3,4,1)`

What is the value of: `x*y`

**Exercise 2**

Consider two vectors, `a, b`

`a=c(1,2,4,5,6)`

`b=c(3,2,4,1,9)`

What is the value of: `cbind(a,b)`

**Exercise 3**

Consider two vectors, `a, b`

`a=c(1,5,4,3,6)`

`b=c(3,5,2,1,9)`

What is the value of: `a<=b`

**Exercise 4**

Consider two vectors, `a, b`

`a=c(10,2,4,15)`

`b=c(3,12,4,11)`

What is the value of: `rbind(a,b)`

**Exercise 5**

If `x=c(1:12)`

What is the value of: `dim(x)`

What is the value of: `length(x)`

**Exercise 6**

If `a=c(12:5)`

What is the value of: `is.numeric(a)`

**Exercise 7**

Consider two vectors, `x, y`

`x=c(12:4)`

`y=c(0,1,2,0,1,2,0,1,2)`

What is the value of: `which(!is.finite(x/y))`

**Exercise 8**

Consider two vectors, `x, y`

` x=letters[1:10]`

`y=letters[15:24]`

What is the value of: `x<y`

**Exercise 9**

If `x=c('blue','red','green','yellow')`

What is the value of: `is.character(x)`

**Exercise 10**

If `x=c('blue',10,'green',20)`

What is the value of: `is.character(x)`

**Want to practice vectors a bit more? We have more exercise sets on this topic here.**

[…] article was first published on R-exercises, and kindly contributed to […]