Create a dataframe Student, perform below mentioned operation on a data frame. Explain with proper example.
- a) Write R Code to convert all the values in a student dataframe into Matrix.
- b) Select the subset of Dataframe
- c) Sort the data within frame
- d) Visualize the Dataframe usingplot ()
stu_data<-data.frame(name=c("James","harry","Robert","Larry","Rozer"), rollno=c(1:5), stream=c("Science","commerce","Biology","commerce","Science")) stu_data #a) Write R Code to convert all the values in a student dataframe into Matrix. stu_mat<-data.matrix(stu_data) stu_mat #b) Select the subset of Dataframe sub_set<-stu_data[c(1,4:5),c(1:3)] sub_set #c) Sort the data within frame print(stu_data[order(stu_data$rollno, decreasing = TRUE), ] ) #d) Visualize the Dataframe usingplot () plot.ts(stu_mat)