Blog


R Practice questions on LIST Data Structure & FACTOR

1) Define a list containing 3 numeric value elements list(1,2,3) , find the SUM of the list elements.

2) from the list defined as b <- list(1:10) ; show all values in the list except the value '3'

3) from the c <- list( 1:5 ,"India" ,c(3,7)) , drop the second element of the list completely

4) for the list ,c <- list( 1:5 ,"India" ,c(3,7)) ,add a new element at the end containing value as 'India'

5) for the list , c <- list( 1:5 ,"India" ,c(3,7)) , define names to the elements as ('First' , 'Second' , 'Third')

6) change the name of the second element in the previous question to '2nd'

7) If A <- factor(c("p", "q", "p", "r", "q")) and levels of A are "p", "q" ,"r", write an R expression that will change the level "p" to "w" so that A is equal to: "w", "q" , "w", "r" , "q".

8) create a ordered Factor variable containing exam score details as ('Low' , 'Average' , 'Above Average' , 'High' , 'Low' , 'High' , 'Average','High') . Now , to see actually , the values are stored in system as (1,2,3....) , display the output of structure function against the ordered factor variable.

9) Define a character vector and then create a factor variable out of this character vector. Now can you show all the unique values in the character vector.

10) First created a variable X which should be a Ordered factor of values c( 'Low' , 'Medium', 'Low ' , 'High' ,'Medium' , 'Low', 'High') . Then convert this ordered factor variable X to factor variable only ( remove order ).

@AUTHOR : Admin

Tags:Eco, Water, Air, Environment

Comments (0)

    No Comments Found
Leave a Comment