Question

A csv file called COS-206_gradebook.csv is provided for this project (see Course Documents). This file contains...

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.

http://www.mediafire.com/file/eqta2teptf6uiop/COS-206_gradebook.csv

Your R script file should contain 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 returns 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:

quizzes—5%;

homework assignments—15%;

term project phase 1—5%;

term project phase 2—3%;

term project phase 3—2%;

exam1 1—10%;

exam2 2—10%;

exam3 3—10%;

final—40%.

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,assessmentTypeWeights);

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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#This function reads data from a csv file called fileName.
#A data frame that stores the contents of this file is returned.
readData <- function(fileName){
df<-read.csv(fileName,header = T,sep = ",")
return(df)
}

dataframe<-readData("COS-206_gradebook.csv")
print(dataframe)


#This function extracts a particular student's grades data from a data frame and returns them.

checkStudent <- function(df, studentName){
return(df[df$name==studentName,])
}

checkStudent(dataframe,'A')

#This function returns a vector/list of three statistics, min, max, and average,
#about the assessment whose name is given as assessmentName.

checkAssessment <- function(df, assessmentName){
df1<-df[df$name==assessmentName,]
ma<-max(df1[2:ncol(df1)])
mi<-min(df1[2:ncol(df1)])
avg<-sum(df1[2:ncol(df1)])/(ncol(df1)-1)
  
lst<-c(mi,ma,avg)
return(lst)
}
  
my_list<-checkAssessment(dataframe,'C')
my_list


#This function returns a vector/list of effective score ratios for the assessment whose name is given as assessmentName.

calcAssessmentEffectiveScoreRatios <- function(df, assessmentName){
assessment<-df[df$name==assessmentName,2:ncol(df)]/df[1,2:ncol(df)]
return(as.list(assessment))
}

res<-calcAssessmentEffectiveScoreRatios(dataframe,'C')
res


#This function returns the number of assessments whose names start with assessmentNamePrefix.
assessmentCount <- function(df, assessmentNamePrefix){
count<-nrow(df[grep(assessmentNamePrefix, df$name),])
return(count)
}

number_of_assessments<-assessmentCount(dataframe,'M')
number_of_assessments
number_of_assessments<-assessmentCount(dataframe,'A|C|M')
number_of_assessments

5 #A data frame that stores the contents of this file is returned 6 readData <-function(fileName) 7 df<-read. csv(fileName, h

Add a comment
Know the answer?
Add Answer to:
A csv file called COS-206_gradebook.csv is provided for this project (see Course Documents). This file contains...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ Write a function parseScores which takes a single input argument, a file name, as a string. Your function should read each line from the given filename, parse and process the data, and print the r...

    C++ Write a function parseScores which takes a single input argument, a file name, as a string. Your function should read each line from the given filename, parse and process the data, and print the required information. Your function should return the number of student entries read from the file. Empty lines do not count as entries, and should be ignored. If the input file cannot be opened, return -1 and do not print anything.     Your function should be named...

  • Write an open_file() and a function that reads a csv data file and returns a dictionary...

    Write an open_file() and a function that reads a csv data file and returns a dictionary Microsoft Word - project09_final_RJE.docx 1/17 This project focuses on analyzing a publicly available dataset containing information about the spread of nCoV. Since this is an active situation, this dataset is constantly being updated with the latest figures. However, for our purposes, we will use a static version of the dataset provided to you with this project (ncov.csv). This static version was lasted updated on...

  • Reading and parsing a CSV file in Java NOTE: a.) The first row contains the field...

    Reading and parsing a CSV file in Java NOTE: a.) The first row contains the field definition b.) Columns are separated by comma This is the data.csv file These are the coding instructions. Questions 1,2 and 3 This is my code so far FirstName Radioactive Man LastName DateOfBirth SSN Salary Role Zip Phone garlic 9/29/1912 846330158 Administration 69989 39157 7166875260 Mockingbird Captain Triumph Deathstroke, th persimmon 9/22/1956 835340509 Administration 13884 39157 1421813391 usb 7/19/1940 8/8/1970 979204716 Back Office 75710 39157...

  • python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gr...

    python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gradebook software to keep track of your grades. Some instructors like to calculate grades based on what is sometimes called a “total points” system. This is the simplest way to calculate grades. A student’s grade is the sum of the points earned on all assignments divided by the sum of the points available...

  • Using C programming For this project, you have been tasked to read a text file with student grade...

    Using C programming For this project, you have been tasked to read a text file with student grades and perform several operations with them. First, you must read the file, loading the student records. Each record (line) contains the student’s identification number and then four of the student’s numerical test grades. Your application should find the average of the four grades and insert them into the same array as the id number and four grades. I suggest using a 5th...

  • Your assignment is to write a grade book for a teacher. The teacher has a text file, which includ...

    Your assignment is to write a grade book for a teacher. The teacher has a text file, which includes student's names, and students test grades. There are four test scores for each student. Here is an example of such a file: Count: 5 Sally 78.0 84.0 79.0 86.0 Rachel 68.0 76.0 87.0 76.0 Melba 87.0 78.0 98.0 88.0 Grace 76.0 67.0 89.0 0.0 Lisa 68.0 76.0 65.0 87.0 The first line of the file will indicate the number of students...

  • All commands must be in the command line. The expense data file is separate. Programming Project...

    All commands must be in the command line. The expense data file is separate. Programming Project #2: Manage Spending Using Commands Objectives: • Understand how to create and manipulate list of objects using array or vector class • Handle input errors and invalid values • Design and create a well-structure program using C++ basic programming constructs and classes. Description: Each “expense” contains 2 values: the spending amount (double) and its description (string) Here is an example of the “expense” data...

  • In Python and in one file please. (Simple functions with an expressions) Create a function called...

    In Python and in one file please. (Simple functions with an expressions) Create a function called load_inventory(filename). The filename argument in this case specifies the name of a file that contains all the inventory/product information for the store, including product names, descriptions, prices, and stock levels. This function should clear any information already in the product list (i.e., a fresh start) and then re-initialize the product list using the file specified by the filename argument. You can structure your file...

  • In Python and in one file please. (Simple functions with an expressions) Create a function called load_inventory(filenam...

    In Python and in one file please. (Simple functions with an expressions) Create a function called load_inventory(filename). The filename argument in this case specifies the name of a file that contains all the inventory/product information for the store, including product names, descriptions, prices, and stock levels. This function should clear any information already in the product list (i.e., a fresh start) and then re-initialize the product list using the file specified by the filename argument. You can structure your file...

  • PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything...

    PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): """ Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT