Write an r script that contains the r functions - readdata


OVERVIEW

The Final Project provides students with an opportunity to apply the techniques learned in the course to answering practical data analysis questions.

General Plan

? Students will use one week of time (Week 12) to work on the Final Project.
? A few practical questions will be asked about the data provided.
? Students must demonstrate the skills learned in Weeks 1-11, such as reading, cleaning, transforming data, writing functions, loops, conditional statements, performing string manipulations and arithmetic calculations etc., to answer these questions.

Final Project Steps

? A csv file called COS­206_gradebook.csv is provided for this project (see Course Documents). This file contains grades data for 17 students on 20 assessments. These assessments include quizzes, homework assignments, term projects, and tests.
? First you are strongly encouraged to open this file in Excel to gain an overview of the data. Note the second row contains point totals for the assessments. For instance, the point total for hw0 (Homework 0) is 20 while the point total for hw1 (Homework 1) is 14.

? Using the csv file, write an R script that contains the following R functions:

1. readData <­ function(fileName);
a. This function reads data from a csv file called fileName. A data frame that stores the contents of this file is returned.

2. checkStudent <­ function(df, studentName);
a. This function extracts a particular student's grades data from a data frame and

returns them.

3. checkAssessment <­ function(df, assessmentName);
a. This function returns a vector/list of three statistics, min, max, and average, about the assessment whose name is given as assessmentName.

4. calcAssessmentEffectiveScoreRatios <­ function(df, assessmentName)
a. This function return a vector/list of effective score ratios for the assessment whose name is given as assessmentName.
b. An effective score ratio for a particular student on a given assessment is the raw score divided by the point total for the assessment. For instance: if a student scored 18 out of 20 for an assessment, then the effective score ratio is 18/20.

5. assessmentCount <­ function(df, assessmentNamePrefix);
a. This function returns the number of assessments whose names start with assessmentNamePrefix.

6. assessmentWeight <­ function(df, assessmentName, assessmentTypeWeights)
a. This function returns the weight for an assessment whose name is given by assessmentName.
b. assessmentTypeWeights is a named vector that contains the weight for each type of assessments. The vector should reflect the following weights assignment:
i. quizzes-5%;
ii. homework assignments-15%;
iii. term project phase 1-5%;
iv. term project phase 2-3%;
v. term project phase 3-2%;
vi. exam 1-10%;
vii. exam 2-10%;
viii. exam 3-10%;
ix. final-40%.
c. A helper function assessmentPrefix <­ function(assessmentName,assessmentTypeWeights) is provided;
i. This function returns the prefix of the assessment whose name is given by assessmentName.
d. The list assessmentTypeWeights is also provided;

7. CalcFinalGrades <­ function(df);
a. This function returns a vector that contains the final grades for all the students.
8. writeReport <­ function(df,finalGradesVector,fileName).

a. This function adds a new column (grade) to df and then writes the updated data frame to a file whose name is given by filename.

? Name your R script "COS­206_FinalProject.R" and submit it by the due date indicated in the Course Calendar.

For your convenience, a template of the R script is provided (see Course Documents). This template:
1. has comments that describe each function;
2. provides the skeleton for each function, you just need to fill R statements in each function body;
3. provides the helper function assessmentPrefix; and
4. provides the declaration and initialization of assessmentTypeWeights.

Another file called COS­206_finalProjectTester.R is also provided. This file contains function calls and their expected results. You can use it to check if your implementations are correct.

(Remember to source your COS­206_FinalProject.R before running the tester, otherwise it will complain that functions are not declared).

Attachment:- COS-216 gradebook.csv

Solution Preview :

Prepared by a verified Expert
Advanced Statistics: Write an r script that contains the r functions - readdata
Reference No:- TGS01287159

Now Priced at $150 (50% Discount)

Recommended (97%)

Rated (4.9/5)