[S] deparse+substitute

Paul Quataert (Paul.Quataert@ihe.be)
Thu, 23 Apr 1998 10:31:57 MET-1METDST

I want to use the deparse(substitute()) combination
to create labels, e.g.
tstS <- function(xv) deparse(substitute(xv))
Then I get for
[1] "letters"

Everything is OK for now. However this trick does not
work anymore when I use tstS as a subroutine in another
procedure, e.g.
tstM <- function(...) tstS(...)
Then I get
[1] "..1"
which is the name of the variable in tstM, and not the
name of the original variable.

Does there exist a DIRECT way to fix this problem ?

Surely there exist indirect solutions, e.g.
tstS <- function(xv,xlab=deparse(substitute(xv))) xlab
tstM <- function(xv,...) tstS(xv,deparse(substitute(xv)))

This works fine, but then I need to define the variable
xv in the main procedure tstM, something I prefer not
to do for my application (and anyhow tstM will not work
anymore when I use this in another procedure).

Thanks for any help.

Paul Quataert
Scientific Instititute of Public Health, Louis Pasteur
(formerly I.H.E. Institute of Hygiene and Epidemiology
Department of Epidemioly
J. Wytsmanstraat 14

tel. +32-2-642 54 02 fax. +32-2-642 54 10
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