s-news
[Top] [All Lists]

How to report automatically-generated argument values

To: "S-plus list (S-plus list)" <s-news@wubios.wustl.edu>
Subject: How to report automatically-generated argument values
From: "P.J.Wells" <P.J.Wells@open.ac.uk>
Date: Fri, 23 May 2003 16:56:36 +0100
I am developing the following function, the first few line of which
presently read:

Glick.test <- function(G.matrix, p.bar = NULL, ...){
        if(is.null(p.bar)) message.2 <- "internal"
                else message.2 <- deparse(substitute(p.bar))
        ....
}

(I need to create message.2 at the start, since -- as the code indicates --
p.bar (a vector) will be created internally if not supplied).

Originally I'd planned to supply p.bar manually, but it now turns out that I
want to make a number of calls to Glick.test using the following

for (i in 1:length(PRM.list))
        assign(paste(PRM.list[i], ".stats", sep=""),
                Glick.test(econ.matrix,
p.bar=eval(parse(text=grp.list[i]))))

where grp.list is a vector (I know...) of character strings naming the
appropriate p.bar objects.

As things stand, the current version of Glick.test() thus returns p.bar as
"eval(parse(text=grp.list[i]))".

Obviously I'd like it to report the names, but I can't hit on a convenient
strategy for this (naturally, I'm hoping to change the above, and the
objects it depends on, as little as possible).

Any suggestions?

Julian Wells

School of Management
The Open University
Walton Hall
Milton Keynes
MK7 6AA
United Kingdom

(01908) 654658
+44 (1908) 654658 

<Prev in Thread] Current Thread [Next in Thread>
  • How to report automatically-generated argument values, P.J.Wells <=