Blog

Practice Questions on Data Frame                                   

1) create a Data Frame named DS_Enthusiasts having 2 columns without having any Column names 
     column 1 :- Sequence number of the row ( or the row number )
     column 2 :- ('Samir' , 'Vijay' , 'Venu' ,'Somu' , 'Chakra' , 'Ram') 
   Please ensure that Column 2 is created not as a Factor

2) For the Data Frame ( DS_Enthusiasts ) created in previous question ,
    a) Show the number of rows in the Data Frame
    b) Show the number of columns in the Data Frame
    c) Show the structure of the data frame
    d) only show the values stored in the 4th row of the dataframe
    e) only show the values stored in the 2nd column of the dataframe where the output should be a dataframe
    f) only show the values stored in the 2nd column of the dataframe where the output should be a Character vector
    g) Show the only first 4 rows in the data frame
    h) Show the only last 4 rows in the data frame
    i) show the summary of the data frame

3) For the Data Frame ( DS_Enthusiasts ) created in previous question ,
     Add rownames as ('Emp_1' , 'Emp_2'  , 'Emp_3' ,'Emp_4' ,'Emp_5','Emp_6')
     Add Column names as ( 'Seq_Nbr' ,'Name'  )
    Please add the rownames and column names in a single R Statement 

4) For the Data Frame ( DS_Enthusiasts ) created in previous question ,
     Add a new column to the data frame with the Column name as 'Name_Len' where 
     the column contains the length of the name string in that row .

5) For the Data Frame ( DS_Enthusiasts ) created in previous question ,
    convert the Name column in the data frame from 'factor' data type to 'Character'

6) For the Data Frame ( DS_Enthusiasts ) created in previous question ,
      a) move the column named 'Name_Len' as first column of the data frame
      b) drop the 4th row from the data frame

7) Using the earlier created data frame ( ques 1 ) DS_Enthusiasts
     create a new data frame named DS_Enthusiasts_LT_5 where -
     it contains only those rows where Name_len value is less than 5 

8) create a Matrix named Matrix_Var_4 as matrix(1:100 , ncol = 4 , byrow = FALSE)
    convert this matrix Matrix_Var_4 into a dataframe

9) using the matrix Matrix_Var_4 created in the previous question 
    reverse the values in columns i.e
    if in col1 , the first value is x , then after reversing , x should be the value of last element in col1
    similar value reversing should be done for all columns in Matrix

10) using the matrix Matrix_Var_4 created in the previous question 
      find the maximum & minimum value per column of the matrix in single R statement 

Thanks & Happy Learning !
Team Intiglide
@AUTHOR : Admin

Tags:Eco, Water, Air, Environment

Comments (0)

    No Comments Found
Leave a Comment