Displaying 1 result from an estimated 1 matches for "fmodify".
Did you mean:
modify
2013 Mar 01
1
S4-classes: Assignment of values to slots by reference
...representation(
par = "matrix",
.cache = "environment")
)
setMethod("initialize", "example", function(.Object, ..., .cache = new.env()) {
callNextMethod(.Object, .cache = .cache, ...)
}
)
ex <- new("example", par = matrix())
fmodify <- function(O1) {
pm <- mean(rnorm(100))
pm <- matrix(pm)
O1 at .cache$par <- pm
}
fmodify(ex)
So far so good. Everything worked nicely. But of course the value computed in the function 'fmodify' is now in the slot ex at .cache$par:
ex at .cache$par
and not in ex at par...