From pgilbert@bank-banque-canada.ca  Wed Mar 10 18:19:09 1999
From: pgilbert@bank-banque-canada.ca (Paul Gilbert)
Date: Wed, 10 Mar 1999 13:19:09 -0500
Subject: .Alias and memory
Message-ID: <99Mar10.134343est.13477@mailgate.bank-banque-canada.ca>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


.Alias and memory
Paul Gilbert