[S] How to replace formal name with value in call to another function?

Terry Elrod (Terry.Elrod@UAlberta.ca)
Wed, 29 Jul 1998 20:41:45 -0600


Here's a problem that sometimes arises in S-Plus:

I have written an estimation method which creates its own class. The
estimation is accomplished by a function au with arguments such as innerarg.
It returns an estimated model of class "au", including a list component
"call" containing the call to au as returned by match.call().

I have also written a stepwise procedure called step.au, which of course
calls au a number of times. The call to au (through update) has an argument
such as innerarg = outerarg, where the value of outerarg is set within
step.au.

The problem is that the model returned by step.au, the best model as found
by step.au, has component call containing innerarg = outerarg. Since
outerarg is not given a value within au, and since its value was not stored
in the object created by step.au, this model cannot be re-estimated by a
call directly to au, or by a call to update, etc.

Here's a bit of code to illustrate the problem. Four dots is used to
indicate missing code.

step.au(object, scope, ...., outerarg){
....
update(object, newformula, innerarg = outerarg)
....
}

au(formula, ...., ...) {
....
rslt$call _ match.call()
rslt
}

> .test _ step.au(object, ...., outerarg = 5)
> .test$call
.... innerarg = outerarg ....
> # The result I would like to see here is innerarg = 5
> # Can anyone help with this?
> # Hint: I've checked into this enough that the answer is not blazingly
obvious.
> # Thanks in advance for any help ....

------------------------------------------------------------------------
Terry Elrod; Assoc. Prof. of Marketing
3-23 Faculty of Business; Univ. of Alberta; Edmonton, AB; Canada T6G 2R6
phone: 403-492-5884; fax: 403-492-3325; email: Terry.Elrod@UAlberta.ca
------------------------------------------------------------------------

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