Question: Using the csv file, write an R script that contains the following R functions: readData
Using the csv file, write an R script that contains the following R functions:
readData <- function(fileName);
This function reads data from a csv file called fileName. A data frame that stores the contents of this file is returned.
checkStudent <- function(df, studentName);
This function extracts a particular student's grades data from a data frame and returns them.
checkAssessment <- function(df, assessmentName);
This function returns a vector/list of three statistics, min, max, and average, about the assessment whose name is given as assessmentName.
calcAssessmentEffectiveScoreRatios <- function(df, assessmentName)
This function return a vector/list of effective score ratios for the assessment whose name is given as assessmentName.
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.
assessmentCount <- function(df, assessmentNamePrefix);
This function returns the number of assessments whose names start with assessmentNamePrefix.
assessmentWeight <- function(df, assessmentName, assessmentTypeWeights)
This function returns the weight for an assessment whose name is given by assessmentName.
assessmentTypeWeights is a named vector that contains the weight for each type of assessments. The vector should reflect the following weights assignment:
< >
homework assignments15%;
term project phase 15%;
term project phase 23%;
term project phase 32%;
exam 110%;
exam 210%;
exam 310%;
< >
A helper function assessmentPrefix <- function(assessmentName,assessmentTypeWeights) is provided;
This function returns the prefix of the assessment whose name is given by assessmentName.
The list assessmentTypeWeights is also provided;
CalcFinalGrades <- function(df);
This function returns a vector that contains the final grades for all the students.
writeReport <- function(df,finalGradesVector,fileName).
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:
has comments that describe each function;
provides the skeleton for each function, you just need to fill R statements in each function body;
provides the helper function assessmentPrefix; and
provides the declaration and initialization of assessmentTypeWeights.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
