[Rd] Why does poly work for unordered factors?

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Wed Oct 22 11:11:05 CEST 2025


>>>>> Roland Fuß via R-devel 
>>>>>     on Wed, 22 Oct 2025 10:24:07 +0200 writes:

    > This doesn't seem intended.

You are right.  The code change, reverting to previous behaviour
notably for "Date",
was prompted on this R-devel list,
    https://stat.ethz.ch/pipermail/r-devel/2022-July/081850.html 

But that the change allows poly(<factor>, .) to work was overlooked (by
me and anyone else ..) and is a bug we will change.

    > See:

    > https://stackoverflow.com/questions/79795583/why-does-poly-work-for-unordered-factors-it-previously-did-not-work

As was already raised in the above SO thread,
what should happen for *ordered* factors is less obvious.
A warning was proposed, but I thought that this was too harsh;
hence, we could use message(), or just keep allowing it.

Opinions?

Martin

--
Martin Maechler
ETH Zurich  and   R Core team

    > -- 
    > Dr. Roland Fuß

    > Thünen-Institut für Agrarklimaschutz/
    > Thünen Institute of Climate-Smart Agriculture

    > Bundesallee 65
    > D-38116 Braunschweig, Germany



More information about the R-devel mailing list