Using R Programming Structures: Object Systems

R Programming    |    Expert
  • 9 videos | 58m 33s
  • Includes Assessment
  • Earns a Badge
Rating 4.6 of 9 users Rating 4.6 of 9 users (9)
R supports not one but multiple alternative object-oriented programming paradigms. These are known as object systems and constitute a relatively underutilized but incredibly powerful feature of the R language. This course will show you how to work effectively with object systems in R. You'll begin by identifying different object systems. You'll then examine how the S3 object system allows some features of object-oriented programming, albeit in a very different form from other OOP languages. You'll move to leverage the R5 object system, also known as the system of reference classes, to create classes and instantiate objects, specify member variables and methods, and initialize values of member functions. You'll also implement inheritance using the system of reference classes. When you're done with this course, you'll be able to utilize different object systems in your R programming projects.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Recognize how the print() function works based on the s3 object system
    Recall the functions print() invokes based on the type of input argument
    Create custom classes using the class(), attr(), and structure() functions
    Extend the print functionality to work with custom classes
  • Implement oop using reference classes
    Create an r5 reference class with various member variables and member functions
    Create a reference class that inherits or derives from another reference class
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 41s
    In this video, you’ll learn more about the course and the instructor. You’ll start by looking at object systems in R. This includes the S3 object system, which is a generic function object-oriented programming system. You’ll see how the S3 object system can be used along with a function. Then you'll move onto the R5 object system, which is commonly known as the system of reference classes. You’ll also create a basic class. FREE ACCESS
  • 10m 7s
    In this video, you’ll watch a demo. This demo is about the S3 object system in R. You’ll begin by initializing a variable. Onscreen you’ll see a variable called date. This is a type called Sys.Date. It holds the current date. Next, you’ll invoke the class function on the date variable and this returns 'Date'. You’ll define a data frame that contains a couple of columns, names, and ages. FREE ACCESS
  • Locked
    3.  Identifying R Function Invocations in S3
    5m 25s
    In this video, you’ll watch a demo. This demo continues with the S3 object system. You’ll pick up where you left off at the end of the last demo. You’ll continue with the print.Date method. This method is named with the keyword print followed by a dot, followed by the name of the class Date. Note the uppercase D. The generic print function knows it can rely on this method to print Date objects. FREE ACCESS
  • Locked
    4.  Creating Custom Classes Using R Functions
    6m 45s
    In this video, you’ll watch a demo. In this demo, you’ll continue to explore the S3 object system in R. You’ll define an object of a particular class. Onscreen you’ll see a simple object called human.sofia. This is a list and it contains the two elements, name, and age. You’ll invoke the class function on this variable human.sofia and what you’ll get back is 'list'. FREE ACCESS
  • Locked
    5.  Extending the print() Function for R Custom Classes
    9m 59s
    In this video, you’ll watch a demo. In this demo, you’ll continue to build on experiments with the S3 object system. You’ll see two classes onscreen. In code cell 27, the class of human.denver is set to be the string "human". You’ve used class as a replacement function. The second method that's visible onscreen now is in code cell 28, where you've used the structure function. FREE ACCESS
  • Locked
    6.  Using Reference Classes in R
    7m 52s
    In this video, you’ll watch a demo. In this demo, you’ll learn more about the system of Reference Classes. You’ll learn this is a different object-oriented system that’s available in R. You’ll discover S3 originally came from the S programming language. As R became more mainstream and as other methods passing object-oriented paradigms such as those in Java became more popular, R added in a system that’s like the Java object-oriented paradigm. FREE ACCESS
  • Locked
    7.  Using Member Variables and Functions in R
    8m 45s
    In this video, you’ll watch a demo. In this demo, you’ll continue exploring reference classes in R. Here, you’ll add in some methods. Onscreen you’ll see the setRefClass function has been invoked. The return value from the setRefClass function can be thought of as a class factory. Using this, you’ll get objects of class Account. This is the class template. FREE ACCESS
  • Locked
    8.  Using Inheritance in Reference Classes in R
    5m 12s
    In this video, you’ll watch a demo. In this demo, you’ll continue to explore reference classes in R. You’ll see how inheritance can be implemented using reference classes. Onscreen, you’ll see a new class StudentAccount which inherits from Account. You’ll see the crucial word here is contains. You’ll see on line 2 of this code cell, "StudentAccount" contains "Account". That's how to tell R that StudentAccount inherits from the Account-based class. FREE ACCESS
  • Locked
    9.  Course Summary
    1m 49s
    In this video, you’ll summarize what you’ve learned in the course. In this course, you’ve learned  Object Systems in R, and the S3 object system. You learned how to change the class attribute for a list. You also defined a function for print to invoke for custom classes. You delved into the use of the use method function to define functions for custom classes, which other functions can invoke. FREE ACCESS

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 159 users Rating 4.5 of 159 users (159)
Rating 4.4 of 34 users Rating 4.4 of 34 users (34)
Rating 4.4 of 11 users Rating 4.4 of 11 users (11)