14.23 Why use R6?

  • Book mentions R6 is similar to the built-in reference classes.
  • Then why use R6?
  • R6 is simpler.
    • RC requires you to understand S4.
  • Comprehensive documentation.
  • Simpler mechanisms for cross-package subclassing, which just works.
  • R6 separates public and private fields in separate environments, RC stacks everything in the same environment.
  • R6 is faster.
  • RC is tied to R, so any bug fixes need a newer version of R.
    • This is especially important if you’re writing packages that need to work with multiple R versions.
  • R6 and RC are similar, so if you need RC, it will only require a small amount of additional effort to learn RC.