# R Programming Vector: Exercises, Practice, Solution

[An editor is available at the bottom of the page to write and execute the scripts.]

## R Programming Vector [28 exercises with solution]

1. Write a R program to create a vector of a specified type and length. Create vector of numeric, complex, logical and  character types of length 6. Go to the editor
Click me to see the sample solution

2. Write a R program to add two vectors of integers type and length 3. Go to the editor
Click me to see the sample solution

3. Write a R program to append value to a given empty vector. Go to the editor
Click me to see the sample solution

4. Write a R program to multiply two vectors of integers type and length 3. Go to the editor
Click me to see the sample solution

5. Write a R program to divide two vectors of integers type and length 3. Go to the editor
Click me to see the sample solution

6. Write a R program to find Sum, Mean and Product of a Vector. Go to the editor
Click me to see the sample solution

7. Write a R program to find Sum, Mean and Product of a Vector, ignore element like NA or NaN. Go to the editor
Click me to see the sample solution

8. Write a R program to find the minimum and the maximum of a Vector. Go to the editor
Click me to see the sample solution

9. Write a R program to sort a Vector in ascending and descending order. Go to the editor
Click me to see the sample solution

10. Write a R program to test whether a given vector contains a specified element. Go to the editor
Click me to see the sample solution

11. Write a R program to count the specific value in a given vector. Go to the editor
Click me to see the sample solution

12. Write a R program to access the last value in a given vector. Go to the editor
Click me to see the sample solution

13. Write a R program to find second highest value in a given vector. Go to the editor
Click me to see the sample solution

14. Write a R program to find nth highest value in a given vector. Go to the editor
Click me to see the sample solution

15. Write a R program to find common elements from multiple vectors. Go to the editor
Click me to see the sample solution

16. Write a R program to convert given dataframe column(s) to a vector. Go to the editor
Click me to see the sample solution

17. Write a R program to extract every nth element of a given vector. Go to the editor
Click me to see the sample solution

18. Write a R program to list the distinct values in a vector from a given vector. Go to the editor
Click me to see the sample solution

19. Write a R program to find the elements of  a given vector that are not in another given vector. Go to the editor
Click me to see the sample solution

20. Write a R program to reverse the order of given vector. Go to the editor
Click me to see the sample solution

21. Write a R program to concatenate a vector. Go to the editor
Click me to see the sample solution

22. Write a R program to count number of  values in a range in a given vector. Go to the editor
Click me to see the sample solution

23. Write a R program to convert two columns of a data frame to a named vector. Go to the editor
Click me to see the sample solution

24. Write a R program to create a vector and find the length and the dimension of the vector. Go to the editor
Click me to see the sample solution

25. Write a R program to combines two given vectors by columns, rows. Go to the editor
Click me to see the sample solution

26. Write a R program to test whether the value of the element of a given vector greater than 10 or not. Return TRUE or FALSE. Go to the editor
Click me to see the sample solution

27. Write a R program to add 3 to each element in a given vector. Print the original and new vector. Go to the editor
Click me to see the sample solution

28. Write a R program to create a vector using : operator and seq() function. Go to the editor
Click me to see the sample solution

R Programming Code Editor:

More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.

﻿