Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.GSO.3.96.990311093259.12487F-100000@laplace>
Date: 1999-03-11T09:37:53Z
From: Jonathan Rougier
Subject: .Alias and memory
In-Reply-To: <99Mar10.134343est.13477@mailgate.bank-banque-canada.ca>

Hi Paul,

On Wed, 10 Mar 1999, Paul Gilbert wrote:

> In an effort to encapsulate my dependence on class in order to deal with
> oldclass/class in Splus  I defined the functions

[ ... ]
 
> This last allows me to end a function definition with
>   ...
>   classed(somecalc, "whatever") }
> 
> rather than
>   ...
>   obj <- somecalc
>   class(obj) <- "whatever"
>   obj }

I may be missing the point, but it seems to me that you could achieve a
`one-line return' using

    structure(somecalc, class = "whatever")

which would also avoid passing somecalc into another function.

Cheers, Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE

"[B]egin upon the precept ... that the things we see are to be 
 weighed in the scale with what we know"  (Meredith, 1879, The Egoist)

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