Professional Documents
Culture Documents
CASE1
/ At first, we have to save the data of IPL 2008-2018 in a Vector with different names or variables as
TASK1 shown below.
Then we have to store the same data in the dataframe as shown below:
WORKSHEET FOR R PROGRAMMING
Then, we can access the data of any year like as shown in the below : print(IPL2008)
WORKSHEET FOR R PROGRAMMING
Then, we have to again store the data of each year in another dataframe and then we can print the
Data of every year using below command as shown below:
(print(IPL)
Then , we can store the year and winner in another dataframe and if we print the same then we
Get the data of IPL winner in each year using following command as shown below:
Print(IPLwithwinner)
WORKSHEET FOR R PROGRAMMING
Hence , these are all about the program with execution of TASK-1
WORKSHEET FOR R PROGRAMMING
CASE2
/TASK
2 At first, we have to create a 4x4 matrix having elements from 1 to 16 in column-wise and also give
The name of the matrix and print the same.
1st
Answe
r Then, we have to access the sub-matrix whose rows have column value > 7 from the given matrix as
shown below:
WORKSHEET FOR R PROGRAMMING
2nd At first, we have to create a list having three objects i.e, vector, matrix and the list itself and
Answe Printing the same as shown below:
Then, we can count the total object in the list using following command as shown below:
->length(N)
WORKSHEET FOR R PROGRAMMING
3rd
First, we have to create a vector with some integer value in it and print the same.
Answe
r
Then, we should check whether the value > 10 or not using following condition and
Return the value in True or False as shown below:
->Print(a>10)
WORKSHEET FOR R PROGRAMMING
4th
Answe
r At first, we have to create the sample list as given in the question and print the same list.
Then, we have to create a new list in which we add +10 in each element of the first vector
Of previous list and print the new list using following command as shown below:
5th
Answe
r At first, we have to create three arrays using rbind and replication function so that it replicates the
Value and seems like a 2x2 matrix and print the same as shown below:
Eg: a= rbind(rep(“a”,2),rep(“b”,2))
Print(a)
WORKSHEET FOR R PROGRAMMING
Then, we have to combine three arrays , taking one row from each one by one then we get following output as
shown below:
WORKSHEET FOR R PROGRAMMING
Hence , These are all about the execution of TASK-2 with implementation in R-Studio.
CASE3
/TASK At first, we need to create the dataframe including the provided data in a question and print the
Same dataframe as shown below:
3
WORKSHEET FOR R PROGRAMMING
Use as.Date() function to convert the date format into backend date format.
Then, we have to access those person’s data whose Salary amount is greater than 579 and print
The same using following command as shown below:
Hence , These are all about the execution of TASK-3 with implementation in R-Studio
THANK YOU !
THE END