[Rd] text() does not accept data of type POSIXlt (PR#2487)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Wed Jan 22 15:14:06 2003


Where is the R bug here?

The dates are *NOT* `of type POSIXlt': they are of type list but
class c("POSIXt", "POSIXlt")

plot() is a generic function with a POSIXlt method.
text() has no POSIXt nor POSIXlt method.

Nothing says that an arbitrary function you choose will accept arbitrary 
input, nor that plot and points, lines, text etc will have compatible 
methods: there are dozens of exceptions.

On Wed, 22 Jan 2003 wolfram@fischer-zim.ch wrote:

> [R 1.6.1]
> 
> PROBLEM
>     If text() is called with an argument of type POSIXlt,
>     I get the following error message:
> 
>         "Error in as.double.default(x) :
>         (list) object cannot be coerced to vector type 14"
> 
> REMARK
>     plot() accepts this data.
> 
> EXAMPLE
>     data( Lifeboats, package='vcd' )
>     attach(Lifeboats)
>     plot( launch, total )
>     text( launch, total, labels=seq( along=as.vector( launch ) ) )
>     detach(Lifeboats)

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595