Displaying 2 results from an estimated 2 matches for "showself".
2012 Aug 06
1
OO code organization
Greetings,
I am using S4 classes and the code is organized by putting each class into a separate source file
in a separate folder:
In Folder base/base.R: defines class "base" and does
setGeneric("showSelf",
function(this) standardGeneric("showSelf")
)
setMethod("showSelf",
signature(this="base"),
definition=
function(this){ ... }
)
For j=1,...,n:
in derived_j/derived_j.R: defines class "derived_j" and does
setMethod("showSelf",
si...
2011 Jun 08
1
Reference Class error message: may be caused by lazy evaluation?
...methods = list(
addOne = function(){
a <<- a+1
print(a)
},
add = function(){
addOne()
},
show = function(){
print(addOne)
},
showself = function(){
print(.self$addOne)
}
))
obj <- new("testclass", a = 1)
obj$show() #
Error in print(addOne) : object 'addOne' not found
obj$addOne()...