[Rd] Small change to plot.xy

Jonathan Rougier J.C.Rougier@durham.ac.uk
Mon, 25 Nov 2002 09:59:20 +0000


Hi Thomas,

Thomas Lumley wrote:
> 
> On Sat, 23 Nov 2002, Jonathan Rougier wrote:
> 
> > OK -- so there are two objections to the proposal:
> >
> > 1) The factor might be a colour specifier
> >
> 
> The function below might help
> It checks:
>   - are the levels colour names
>   - are they numbers
>   - are they color specifiers like #a0f3d2
> otherwise it returns the underlying codes with unclass().

Is there a case, given that colours *can* be represented in several
different ways, for including the two functions "is.color" and
"as.color" in the base?  I imagine the latter would work like
"as.numeric", putting NA for elements that cannot be coerced to
colours.  The function "as.color" might return a specific colour format,
perhaps #hhhhhh if that is the most general, which would simplify other
parts of the code.

Jonathan.

-- 
Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html