s-news
[Top] [All Lists]

RE: [S] renaming objects

To: "'Nicole DePriest Demers'" <ntd@stat.ohio-state.edu>, s-news@wubios.wustl.edu
Subject: RE: [S] renaming objects
From: "Venables, Bill (CMIS, Cleveland)" <Bill.Venables@cmis.CSIRO.AU>
Date: Thu, 1 Jul 1999 09:44:53 +1000
Sender: owner-s-news@wubios.wustl.edu
Nicolle Demers asks:



Hello Splus Users,

Is there any built-in Splus command that lets you rename objects without
having to go thru the ol' two-step
        new <- old
        rm(old)

????  A cursory glance at the help files and V&R didn't reveal anything but
I have been known to miss the obvious on occasion.
Just curious.


I personally think the old two step is the only safe dance in this
situation, but if you want to walk on the wild (and lazy) side you could use
a function like

rem <- function(obj) {
        x <- obj
        remove(deparse(substitute(obj)), where = 1)
        x
}

Then you can make it a new one step:

v <- rem(x)

Now remember you did not get this from me!  We had good reasons for not
going into such tricks and this message (which if cornered I will denounce
as a total forgery) is merely, as you say, "for the curious".  :-)

Bill Venables

Bill Venables, Statistician, CMIS Environmetrics Project.
Physical address:                            Postal address:
CSIRO Marine Laboratories,                   PO Box 120,       
233 Middle St, Cleveland, Queensland         Cleveland, Qld, 4163
AUSTRALIA                                    AUSTRALIA
Telephone: +61 7 3826 7251
      Fax: +61 7 3826 7304     Email: Bill.Venables@cmis.csiro.au
_______________________________________________________________________
 <<[S] renaming objects>> 
--- Begin Message ---
To: s-news@wubios.wustl.edu
Subject: [S] renaming objects
From: Nicole DePriest Demers <ntd@stat.ohio-state.edu>
Date: Thu, 1 Jul 1999 08:14:07 +1000
Hello Splus Users,

Is there any built-in Splus command that lets you rename objects without
having to go thru the ol' two-step

                new <- old
                rm(old)

????  A cursory glance at the help files and V&R didn't reveal anything
but I have been known to miss the obvious on occasion.

Just curious.

____________________________________________________________________________
__
Nicole Demers
Statistics Department
The Ohio State University
1958 Neil Ave., #404
Columbus, OH 43210, USA
(614) 292-6038
ntd@stat.ohio-state.edu

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

--- End Message ---
<Prev in Thread] Current Thread [Next in Thread>
  • [S] renaming objects, Nicole DePriest Demers
    • RE: [S] renaming objects, Venables, Bill (CMIS, Cleveland) <=