Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
15 views1 page

Practice Assignment 2

The document outlines a practice assignment for IT3011 - TPSM, requiring students to perform various tasks using R programming. Tasks include calculating average marks, creating new data frames based on age and scores, defining a function to adjust marks, and generating a custom summary function. The assignment is structured to assess students' ability to manipulate data frames and apply statistical functions in R.

Uploaded by

testingcode44
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Practice Assignment 2

The document outlines a practice assignment for IT3011 - TPSM, requiring students to perform various tasks using R programming. Tasks include calculating average marks, creating new data frames based on age and scores, defining a function to adjust marks, and generating a custom summary function. The assignment is structured to assess students' ability to manipulate data frames and apply statistical functions in R.

Uploaded by

testingcode44
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

IT3011 – TPSM Practice Assignment

(01) Download the df.txt text document given in the Courseweb and create the two data frames
(df1 & df2) as given. Then do the following tasks using R. (70 Marks)
a) Find the overall average mark for Mathematics & English for all students. (5 Marks)
b) Create a new data frame called df3 using df1 & df2 data frames with ID, Age, Maths &
English column for students who are older than or equal 25. You must use R codes for
creating this data frame and cbind() function may help you to combine data frames.
(20 Marks)
c) Create a new column called Total in df3 data frame for showing the total marks for
Mathematics & English for each student. (10 Marks)
d) Create function called fun_add for returning a value by adding 5 marks when one mark is
given as the input. (10 Marks)
e) Using the above created user defined function update the Total column in df3 by adding
5 marks. (5 Marks)
f) The lecturer has decided to give marks for the students who are above or equal age 25
as well as who have scored total marks above or equal to 140. Create a new column in
df3 called Result by showing “Award” or “No Award” for each student based on their
total mark. (10 Marks)
g) Create the df4 data frame as given in the df.txt text file and give a sub data frame of the
IDs and Names of awarded students. (10 Marks)
(02) summary() function shows a summary for any object in R. For vectors, the summary function
gives a summary with following statistical summaries,
Min, 1st Qu, Median, Mean, 3rd Qu, Max
Create a new summary function called five_num_summary which includes only following
summaries excluding mean,
Min, 1st Qu, Median, 3rd Qu, Max
Further change the names as follows,
Min Value, Q1 Value, Median Value, Q3 Value, Max Value
In this task following R functions may help you. (30 Marks)

• summary()
• as.vector()
• names()

You might also like