You are on page 1of 2

February 17, 2019

R Tutorial

Perform the following operations in R

1. Add two vectors

v1 =f2, 4, 5.5, 6.8g; v2 =f2.4, 5.4, 5.5, 8.8g

2. Subtract two vectors

v1 =f2, 4, 5.5, 6.8g; v2 =f2.4, 5.4, 5.5, 8.8g

3. Multiply two vectors

v1 =f2, 4, 5.5, 6.8g; v2 =f2.4, 5.4, 5.5, 8.8g

4. Divide the rst vector by the second

v1 =f2, 4, 5.5, 6.8g; v2 =f2.4, 5.4, 5.5, 8.8g

5. Check if each element of the rst vector is greater than the


corresponding element of the second vector.

v1 =f2, 4, 5.5, 6.8g; v2 =f2.4, 5.4, 5.5, 8.8g

6. Check if each element of the rst vector is less than the corresponding
element of the second vector.

v1 =f2, 4, 5.5, 6.8g; v2 =f2.4, 5.4, 8.5, 8.8g

7. Check if each element of the rst vector is equal to the corresponding


element of the second vector.

v1 =f2, 4, 5.5, 8.8g; v2 =f2.4, 5.4, 5.5, 8.8g

8. Check if each element of the rst vector is less than or equal to the
corre-sponding element of the second vector.

v1 =f2, 4, 5.1, 8.8g; v2 =f1.4, 5.4, 5.5, 8.8g

9. Check if each element of the rst vector is greater than or equal to the
corresponding element of the second vector.
v1 =f2, 4, 5.1, 8.8g; v2 =f1.4, 5.4, 5.5, 8.8g

10. Check if each element of the rst vector is unequal to the corresponding
element of the second vector. v1 =f2, 4, 5.1, 8.8g; v2 =f1.4, 5.4, 5.5, 8.8g

You might also like