.Alias and memory
Paul Gilbert
pgilbert@bank-banque-canada.ca
Wed, 10 Mar 1999 13:19:09 -0500
In an effort to encapsulate my dependence on class in order to deal with
oldclass/class in Splus I defined the functions
tfclass <- class
"tfclass<-" <- function(x, value){ class(x) <- value ; x }
and also the function
classed <- function(x, cls) {class(x) <- cls; x}
This last allows me to end a function definition with
...
classed(somecalc, "whatever") }
rather than
...
obj <- somecalc
class(obj) <- "whatever"
obj }
Unfortunately, these seem to increase my memory usage in R substantially. Using
tfclass <- .Alias(class)
"tfclass<-" <- .Alias(get("class<-"))
helps a bit. Is there a better overall approach to this that avoids increasing
the memory demands?
Paul Gilbert
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._