Re: [R] ?bug? strange factors produced by chron

From: Petr Pikal <petr.pikal_at_precheza.cz>
Date: Tue 14 Feb 2006 - 01:30:35 EST

Hi

On 13 Feb 2006 at 12:04, Prof Brian Ripley wrote:

Date sent:      	Mon, 13 Feb 2006 12:04:49 +0000 (GMT)
From:           	Prof Brian Ripley <ripley@stats.ox.ac.uk>
To:             	Petr Pikal <petr.pikal@precheza.cz>
Copies to:      	r-help@stat.math.ethz.ch
Subject:        	Re: [R] ?bug? strange factors produced by chron

> On Mon, 13 Feb 2006, Petr Pikal wrote:
>
> > Thank you very much.
> >
> > On 13 Feb 2006 at 10:54, Prof Brian Ripley wrote:
> >
> > Date sent: Mon, 13 Feb 2006 10:54:21 +0000 (GMT)
> > From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
> > To: Petr Pikal <petr.pikal@precheza.cz>
> > Copies to: r-help@stat.math.ethz.ch
> > Subject: Re: [R] ?bug? strange factors produced by chron
> >
> >> 1) The obvious test is via is.factor(), and you have not used that.
> >
> > I used it with TRUE result but did not use in my post (mea culpa)
> >> is.factor(kvartaly)
> > [1] TRUE
> >
> >> 2) Your example works for me, so what versions of R and chron is
> >> this?
> >
> > Package: chron
> > Version: 2.3-1
> > R 2.2.1 and W2000
> >
> > but problem is probably in interaction (see below)
> >>
> >> 3) Here's my guess. split is using the C-level test isFactor. That
> >> tests that the factor is of type integer, so please try
> >>
> >>> typeof(kvartaly)
> >
> > > typeof(kvartaly)
> > [1] "double"
> >
> > Problem is probably not in chron but in interaction, which silently
> > transfers factor type to double
> >
> >> typeof(factor(letters[1:2]))
> > [1] "integer"
> >
> >> typeof(interaction(factor(letters[1:2]), factor(letters[3:4])))
> > [1] "double"
>
> 2.2.1 does not do that for me (and contains ans <- as.integer(ans),
> and has since Sept 2001). Do you have a private copy?

Yes, you have got it. I used (probably due to different handling of drop) a copy of interaction from Hmisc package from 2001, where there is no as.integer(ans). I'll switch to base version and see if there is no other problems with some of my code.

As I noticed this behaviour only recently and use interaction from time to time so some other change had to sneaked around me without noticing.

Thank you again.

Best regards.
Petr

>
> --
> 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
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal@precheza.cz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Feb 14 01:39:43 2006

This archive was generated by hypermail 2.1.8 : Wed 15 Feb 2006 - 13:27:59 EST