R Object-oriented Programming
eBook - ePub

R Object-oriented Programming

  1. 190 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

R Object-oriented Programming

Book details
Book preview
Table of contents
Citations

About This Book

R is best suited to produce data and visual analytics through customizable scripts and commands, instead of typical statistical tools that provide tick boxes and drop-down menus for users. The book is divided into three parts to help you perform these steps. It starts by providing you with an overview of the basic data types, data structures, and tools available in R that are used to solve common tasks. It then moves on to offer insights and examples on object-oriented programming with R; this includes an introduction to the basic control structures available in R with examples. It also includes details on how to implement S3 and S4 classes. Finally, the book provides three detailed examples that demonstrate how to bring all of these ideas together.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access R Object-oriented Programming by Kelly Black in PDF and/or ePUB format, as well as other popular books in Computer Science & Object Oriented Programming. We have over one million books available in our catalogue for you to explore.

Information

Year
2014
ISBN
9781783986682
Edition
1

R Object-oriented Programming


Table of Contents

R Object-oriented Programming
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Copyright violations
Questions
1. Data Types
Assignment
The workspace
Discrete data types
Integer
Logical
Character
Factors
Continuous data types
Double
Complex
Special data types
Notes on the as and is functions
Summary
2. Organizing Data
Basic data structures
Vectors
Lists
Data frames
Tables
Matrices and arrays
Censoring data
Appending rows and columns
Operations on data structures
The apply commands
apply
lapply and sapply
tapply
mapply
Summary
3. Saving Data and Printing Results
File and directory information
Entering data
Entering data from the command line
Reading tables from files
CSV files
Fixed-width files
Printing results and saving data
Saving a workspace
The cat command
The print, format, and paste commands
Primitive input/output
Network options
Opening a socket
Basic socket operations
Summary
4. Calculating Probabilities and Random Numbers
Overview
Distribution functions
Cumulative distribution functions
Inverse cumulative distribution functions
Generating pseudorandom numbers
Sampling
Summary
5. Character and String Operations
Basic string operations
Six focused tasks
Determining the length of a string
Location of a substring
Extracting or changing a substring
Transforming the case
Splitting strings
Creating formatted strings
Regular expressions
Summary
6. Converting and Defining Time Variables
Introduction and assumptions
Converting strings to time data types
Converting time data types to strings
Operations on time data types
Summary
7. Basic Programming
Conditional execution
Loop constructs
The for loop
The while loop
The repeat loop
Break and next statements
Functions
Defining a function
Arguments to functions
Scope
Executing scripts
Summary
8. S3 Classes
Defining classes and methods
Defining objects and inheritance
Encapsulation
A final note
Summary
9. S4 Classes
Introducing the Ant class
Defining an S4 class
Defining methods for an S4 class
Defining new methods
Polymorphism
Extending the existing methods
Inheritance
Miscellaneous notes
Summary
10. Case Study – Course Grades
Overview
The Course class
The definition of the Course class
Reading grades from a file
The assignment classes
The NumericGrade class
The LetterGrade class
Example – reading grades from a file
Defining indexing operations
Redefining existing functions
Redefining arithmetic operations
Summary
11. Case Study – Simulation
The simulation classes
The Monte-Carlo class
Examples
Summary
A. Package Management
Index

R Object-oriented Programming

Copyright © 2014 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2014
Production reference: 1201014
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-668-2
www.packtpub.com

Credits

Author
Kelly Black
Reviewers
Mzabalazo Z. Ngwenya
Prabhanjan Tattar
Tengfei Yin
Commissioning Editor
Akram Hussain
Acquisition Editor
Richard Brookes-Bland
Content Development Editor
Parita Khedekar
Technical Editor
Tanvi Bhatt
Copy Editors
Simran Bhogal
Sarang Chari
Ameesha Green
Paul Hindle
Karuna Narayanan
Project Coordinator
Neha Thakur
Proofreaders
Simran Bhogal
Maria Gould
Ameesha Green
Paul Hindle
Indexer
Priya Sane
Graphics
Disha Haria
Abhinash Sahu
Production Coordinator
Alwin Roy
Cover Work
Alwin Roy

About the Author

Kelly Black is a faculty member in the Department of Mathematics at Clarkson University. His background is in numerical analysis with a focus on the use of spectral methods and stochastic differential equations. He makes extensive use of R in the analysis of the results of Monte-Carlo simulations.
In addition to using R for his research interests, Kelly also uses the R environment for his statistics classes. He has extensive experience sharing his experiences with R in the classroom. The use of R to explore datasets is an important part of the curriculum.

Table of contents

  1. R Object-oriented Programming