Book Image

R Object-oriented Programming

By : Kelly Black
Book Image

R Object-oriented Programming

By: Kelly Black

Overview of this book

Table of Contents (19 chapters)
R Object-oriented Programming
About the Author
About the Reviewers
Calculating Probabilities and Random Numbers
Package Management

The Course class

The Course class is used to keep track of all of the grades for a course. This class will read in the information from a file, decide whether grades are numeric grades or letter grades, and create an appropriate assignment object to hold the grades. The details for the class are shown in the following figure. We'll first discuss the data and then the methods associated with the class. We'll then give some details on how to define the class. Most of the code associated with the accessors is omitted for the sake of brevity, but the full code is available on the website associated with this book.

First, there are three data structures (slots) associated with the class. The first is the name of the CSV file that contains all of the grades for the class. The second is a vector of prefixes used to determine what kind of graded tasks are in the file. The last is a list that contains all of the assignments.

There are seven methods. All but one are used to set and get the values for...