Re: [S] More on the trellis question

Bill Venables (wvenable@attunga.stats.adelaide.edu.au)
Wed, 11 Mar 1998 09:13:03 +1030


Richard E. Higgs, Jr. writes:
>
> What I'm exactly interested in doing is creating a function
> called
>
> foo(inFile, psFile)

...

> I have noticed a problem extending the solutions to my post.
> Suppose instead of
>
> trellis.device(postscript, file="myfile.ps")
>
> I want to use
>
> trellis.device(postscript, file=psFile)
>
> where psFile is a valid character string.

(I presume you mean psFile is a valid character string
*argument*.)

> Using the postscript() command passing the postscript file
> name in this way works fine. However, trellis.device()
> returns the following error:
>
> Error in trellis.device(postscript, file = psFile): Object
> "psFile" not found
> Dumped
>
> Does trellis.device() require some type of object (other than
> a character string) for the file parameter?
>
> Am I missing something in my documentation here?

Not really, though it is the fault of the documentation rather
than anything else. Lazy evaluation and the scoping rules of S
are something it takes a while to come to terms with.

Instead of

trellis.device(postscript, file = psFile)

in your function, try

eval(substitute(trellis.device(postscript, file = psFile)))

this essentially makes evaluation a little less lazy, probably by
about as much as you need.

(Full explanations are extra... Sigh.)

Bill Venables.

-- 
Bill Venables, Head, Dept of Statistics,    Tel.: +61 8 8303 5418
University of Adelaide,                     Fax.: +61 8 8303 3696
South AUSTRALIA.     5005.   Email: Bill.Venables@adelaide.edu.au

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