[S] using barchart with variable formula

Pierre Delfosse (info@chaineux.centexbel.be)
Mon, 15 Jun 1998 15:20:21 -0400


Dear S-plus users,

Willing to pass a variable name inside the "formula" parameter of
barchart(), I have tried a solution by Bill Venables (30 Sep 97 on this
news list), using substitute(). That solution works for xyplot() but not
for barchart() ,as it can be seen with the test() call hereafter.

I use Windows 95 and Splus 4.3.

In fact, barchart() seems to ignore the current frame, looking rather in
the working directory as the no-problem run of test1() illustrates it.

****************************
> test_function(var,data)
{
form_substitute(X1 ~ var | X3)
barchart(form,data=data)
}

> test1_function(var,data)
{
form<<-substitute(X1 ~ var | X3)
barchart(form,data=data)
}

> data_data.frame(matrix(rnorm(9),ncol=3))

*** test1() is run without problem ***
> test1(X2,data)

*** test() goes to dump if "form" deleted from working database ***
> rm(form)
> test(X2,data)
Error: Object "form" not found
Dumped

*******************************

Any help would be very appreciated.

Many thanks.

----------------------------------------------------------------------
Pierre Delfosse Address: CENTEXBEL
info@chaineux.centexbel.be avenue du parc, 38
Telephone: 32-87-322443 B-4650 Chaineux BELGIUM
Fax: 32-87-340518
-----------------------------------------------------------------------
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