Skip to content
/ R6 Public

Encapsulated object-oriented programming for R

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

r-lib/R6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

73b1298 · Mar 12, 2025
Oct 27, 2022
Mar 12, 2025
Dec 13, 2019
Feb 10, 2025
Mar 31, 2022
Feb 14, 2025
Oct 28, 2022
Sep 6, 2024
Aug 4, 2014
Dec 8, 2021
Mar 12, 2025
Sep 6, 2024
Sep 6, 2024
Sep 5, 2024
Mar 12, 2025
Feb 14, 2025
Mar 31, 2022
Dec 8, 2021

Repository files navigation

R6: Encapsulated object-oriented programming for R

R-CMD-check

R6 is an implementation of encapsulated object-oriented programming for R, and is a simpler, faster, lighter-weight alternative to R's built-in reference classes. This style of programming is also sometimes referred to as classical object-oriented programming.

Some features of R6:

  • R6 objects have reference semantics.
  • R6 cleanly supports inheritance across packages.
  • R6 classes have public and private members.

In contrast to R's reference classes, R6 is not built on the S4 class system, so it does not require the methods package. Unlike reference classes, R6 classes can be cleanly inherited across different packages.

See the Introduction article for usage examples.

Installation

To install R6 from CRAN:

install.packages('R6')

To install the development version (requires the devtools package):

devtools::install_github('r-lib/R6', build_vignettes = FALSE)

Documentation

Why R6?

Why the name R6? When R's reference classes were introduced, some users, following the names of R's existing class systems S3 and S4, called the new class system R5 in jest. Although reference classes are not actually called R5, the name of this package and its classes takes inspiration from that name.

The name R5 was also a code-name used for a different object system started by Simon Urbanek, meant to solve some issues with S4 relating to syntax and performance. However, the R5 branch was shelved after a little development, and it was never released.