R 中的 S3 与 R6 面向对象编程
Richie Cotton
Data Evangelist at DataCamp




library(R6) thing_factory <- R6Class( "Thing",private = list( a_field = "a value", another_field = 123 ))
a_thing <- thing_factory$new()
another_thing <- thing_factory$new()
yet_another_thing <- thing_factory$new()
R6Class() 定义类生成器private 列表new() 方法创建对象R 中的 S3 与 R6 面向对象编程