R Object-oriented Programming
上QQ阅读APP看书,第一时间看更新

What this book covers

A list of the chapters is given here. The first three chapters focus on the basic requirements associated with getting data into the system and the most basic tasks associated with calculations associated with data. The next three chapters focus on the miscellaneous issues that arise in practice when working with and examining data including the mechanics of dealing with different data types. The next three chapters focus on basic and advanced programming topics. The final three chapters provide more detailed examples to demonstrate how all of the ideas can be brought together to solve problems.

Chapter 1, Data Types, offers a broad overview of the different data types. This includes basic representations such as float, double, complex, factors, and integer representations, and it also includes examples of how to enter vectors through the interactive shell. A brief discussion of the most basic operations and how to interact with the R shell is also given.

Chapter 2, Organizing Data, offers a more detailed look at the way data is organized within the R environment. Additional topics include how to access the data as well as how to perform basic operations on the various data structures. The primary data structures examined are lists, arrays, tables, and data frames.

Chapter 3, Saving Data and Printing Results, offers a detailed look at the ways to bring data into the R environment and builds on the topics discussed in the previous chapter. Additional topics revolve around the ways to display results as well as various ways to save data.

Chapter 4, Calculating Probabilities and Random Numbers, offers a detailed examination of the probability and sampling features of the R language. The R environment includes a number of features to aid in the way data can be analyzed. Any statistical analysis includes an underlying reliance on probability, and it is a topic that cannot be ignored. The availability of a wide variety of probability and sampling options is one of the strengths of the R language, and we explore some of the options in this chapter.

Chapter 5, Character and String Operations, offers a detailed examination of the various options available for examining, testing, and performing operations on strings. This is an important topic because it is not uncommon for datasets to have inconsistencies, and a routine that reads data from a file should include some basic checks.

Chapter 6, Converting and Defining Time Variables, offers a detailed examination of the time data structure. A basic introduction is given in the first chapter, and more details are provided in this chapter. The prevalence of time-related data makes the topic of these data structures too important to ignore.

Chapter 7, Basic Programming , offers a detailed examination of the most basic flow controls and programming features of the R language. The chapter provides details about conditional execution as well as the various looping constructs. Additionally, mundane topics associated with writing programs, execution, and formatting are also discussed.

Chapter 8, S3 Classes, offers a detailed examination of S3 classes. This is the first and most common approach to object-oriented programming. The use of S3 classes can be confusing to people already familiar with object-oriented programming, but their flexibility has made them a popular way to approach object-oriented programming in R.

Chapter 9, S4 Classes, offers a detailed examination of S4 classes. This is a more recent approach to object-oriented programming compared to S3 classes. It is a more structured approach and is more familiar to people who have experience with object-oriented programming.

Chapter 10, Case Study – Course Grades, offers an in-depth example of a grade-tracking application. This is the first of three examples, and it is the simplest example. It was chosen as it is something that is likely to be more familiar to a wider range of people.

Chapter 11, Case Study – Simulation, offers an in-depth example of an application that is used to generate data based on Monte-Carlo simulations. The application demonstrates how an object-oriented approach can be used to create an environment used to execute simulations, organize the results, and perform a basic analysis on the results.

Chapter 12, Case Study – Regression, offers an in-depth example of an application that offers a wide range of options you can use to perform regression. Regression is a common task and occurs in a wide variety of contexts. The application that is developed demonstrates a flexible way to handle both continuous and ordinal data as a way to demonstrate the use of a flexible object-oriented approach. You can download this chapter form https://www.packtpub.com/sites/default/files/downloads/6682OS_Case_Study_Regression.pdf.

Appendix, Package Management, gives a brief overview of installing, updating, and removing packages is given. Packages are libraries that can be added to R that extend its capabilities. Being able to extend R and make use of other libraries represents one R's more powerful features.