s-news
[Top] [All Lists]

Re: name of object as text?

To: hatfield@solander.bc.ca
Subject: Re: name of object as text?
From: Spencer Graves <spencer.graves@PDF.COM>
Date: Sun, 23 Mar 2003 08:30:06 -0800
Cc: s-news@wubios.wustl.edu
References: <NGBBIANLKLEKKOMCPBKMEEPICLAA.hatfield@solander.bc.ca>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01
How about the following:

tst <- 1:2
Plot.function <-
function(x){
        xName <- deparse(substitute(x))
        Main <- paste('Plot of', xName)
        plot(x, main=Main)
        
}
Plot.function(tst)

Does this do what you want?
Spencer Graves

Todd Hatfield wrote:
I'd like to be able to use an object's name as the title in plotting
functions.  Is there a way to capture the name of an object as a character
string?


(I'm using: Professional Edition Version 6.1.2 Release 1 for Microsoft
Windows : 2002)

Thanks for any help!

Todd Hatfield

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



<Prev in Thread] Current Thread [Next in Thread>