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

Wolfram Fischer - Z/I/M wolfram@fischer-zim.ch
Wed Jan 22 18:32:02 2003


Thanks for your hint about POSIXt and POSIXlt.

Excuse me that I bothered you with my message.

I thought that text() is a function which is used often in 
combination with plot(). I have the opinion that it would be
helpful if such functions are harmonised as good as possible. -
Therefore I took the time to inform about my observation.

Wolfram Fischer

--- In reply to: ---
>Date:    22.01.03 14:13 (+0000)
>From:    ripley@stats.ox.ac.uk
>To:      To wolfram@fischer-zim.ch
>Subject: Re: [Rd] text() does not accept data of type POSIXlt (PR#2487)
>
> 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