Classes in R with R6

The R language supports object oriented programming, although there is no universal standard for class definition. R has different class systems, S3, S4, R5, and R6. Since R is, in its origins, a statistics playground software, some features from modern general purpose programming languages are not present there. Complex projects are a bit harder to write, as a result, but not impossible, and the situation keeps improving thanks to the community support.

Why the name R6? As per the official R documentation (https://cran.r-project.org/web/packages/R6/vignettes/Introduction.html), R6 is the successor of the package R5, whose development was halted. R6 is an attempt to improve some deficiencies in S3 and S4. It is also the recommended method to implement self-modifying objects, as is the case here. We need to change the weights of the network as the training progresses.

How do we define an R6 class? Let's show you this with an example in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset