Object Oriented Programming in R

Object Oriented Programming in R

Course Level: Advanced (6 hours)

The training course will cover R object-oriented programming techniques. We’ll discuss what OOP is and the different varieties within R. Beginning with the popular S3 and S4 OOP frameworks, we’ll finish with the new {R6} package that is used extensively in Shiny applications. By the end of the course, participants will be able to use OOP within their own code.

Download course details

Book: Object Oriented Programming in R

Start Date:
Price:
Venue Details:
Time:
Duration:

No Events Currently Scheduled

Sorry, there are no upcoming events for this course, but please get in touch if you would like to be kept informed when events are scheduled in the future.

Course Details

Outline

  • Advanced Functions:

    • Scoping rules (including lexical scope)
    • The … argument
    • Argument matching
  • S3 classes:

    • Introduction to object-oriented programming
    • Constructing S3 objects
    • Drawbacks
  • S4 classes:

    • Creating and using S4 classes
    • Differences between S3 and S4 classes
  • R6 classes

    • Differences between {R6} and S3/S4
    • Mutable states
    • Creating methods
    • Shallow and deep copies

Learning outcomes

By the end of the course, participants will be able to…

  • Select the most appropriate form of OOP for their task
  • Leverage encapsulation, polymorphism and inheritance to provide a nice user interface to their code
  • Write functions with rich results, user-friendly display and programmer-friendly internals
  • Extend the functionality of functions for new object types
  • Write code that is extensible by others

Prior knowledge

This course assumes that participants are comfortable with the fundamentals of R programming, writing functions and control flow. It follows on from the Programming with R course.

Materials Preview