我正在实现一个新的 R6Class 并尝试动态添加新成员(https://cran.r-project.org/web/packages/R6/vignettes/Introduction.html#adding-members-to-an-existing-class ) 但是当我实现 getx2 函数时,我得到了这个错误“__Deferred_Default_Marker__”(无论它是否是动态的)。
Simple <- R6Class("Simple",
public = list(
x = 1,
getx = function() self$x,
getx2 = function() return(self$x * 2)
)
)
# To replace an existing member, use overwrite=TRUE
Simple$set("public", "x", 10, overwrite = TRUE)
s <- Simple$new()
s$getx2() # this returns "__Deferred_Default_Marker__"
对此有什么想法吗?就像在文档中一样