From J.C.Rougier@durham.ac.uk  Mon Nov 25 09:59:20 2002
From: J.C.Rougier@durham.ac.uk (Jonathan Rougier)
Date: Mon, 25 Nov 2002 09:59:20 +0000
Subject: [Rd] Small change to plot.xy
References: <Pine.A41.4.44.0211231034450.96242-100000@homer01.u.washington.edu>
Message-ID: <3DE1F478.3FD2BA5B@durham.ac.uk>

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



[Rd] Small change to plot.xy
Jonathan Rougier