(Hmm. Why do I suspect Jeff might be a SAS refugee... :-)
I suppose the way you figured out to do it might be
> con <- cat == "a"
> plot(x[con], y[con], xlab = "x", ylab = "y", main = "cat = a")
in which case I can't see all that much of a problem. There are
other possibilities, though.
Suppose x, y and cat are all part of a data frame, dat. If not,
make one.
1. With Trellis graphics you could try
> xyplot(y ~ x, dat, subset = cat == "a")
2. With conventional graphics you could use
> attach(dat[dat$cat == "a", ])
> plot(x, y, main = "cat = a")
> detach()
However this assumes you have no separate variables called x, y
or cat in position 1 of the search path. If you do have those,
you need to attach to, and detach from postion 1.
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