Blog

Practice Questions on Vectors in R 


1) Define an Atomic Vector containing a range of integers from 10 to 30 

2) Find the count of number of elements in the Vector created in the previous question.

3) show the first 10 elements from this vector created

4) show 6 elements from 11th position onwards from this vector created in previous question.

5) show only those elements from this numeric vector ( created earlier )  which are divisible by 3

6) create a new numeric vector which contains number 100 to 1 in descending order

7) create a vector which contains 1 to 20 and then display the output in reverse order 

8) find the position of a value in a vector [ ex: find the position of the value 5 in vector a = c( 2, 6 , 3 ,5 ,7) ]

9) Find the maximum & minimum value in a numeric  vector [ X = c( 10 , 23 , 9 , 11 ,43 ,31 )]

10) show the content of the numeric vector in sorted order ( ascending )  

11) show the content of the numeric vector in sorted order ( descending )  

12) define a vector V containing values from 10 to 2 using ':' method

13) create a vector with values c(3,4,7,9) and then replace the value 4 in the vector by value 5

14) Create a vector containing values between 10 & 100 with values in increment of 3

15) Set the value of a Vector to NULL

16) extract the 4th largest number in the numeric vector having values c( 23, 11 , 43 ,14 ,10 ,99,85,45)

17) extract the 4th smallest number in the numeric vector having values c( 23, 11 , 43 ,14 ,10 ,99,85,45)

18) Check the Data Type of a vector

19) create a vector ( 1, 2, 3) and then name the each element of vector as 'First' , 'Second' & 'Third'

20) access the second element of the vector created in previous question using the name as index

@AUTHOR : Admin

Tags:Eco, Water, Air, Environment

Comments (0)

    No Comments Found
Leave a Comment