Hi
Being able to do object oriented programming in R is really good. I now
started using the Reference Classes and really like it.
Though, I have one problem: I cannot find a way to update a method on an
existing object.
The flexibility that scripting gives (really needed for interactive data
analysis) is lost if everything have to be recalculated all the time.
For example:
cl1 <- setRefClass("cl1",
fields=list(x="data.frame"),
methods=list(
init=function(){"Read and process data"},
fitModel=function(){"Fit different kind of models and keep the results
in x and other fields"}
)
)
tmp <- cl1$new()
tmp$x <- 5
tmp$fun()
[[alternative HTML version deleted]]