[Rd] head/tail breaking change

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Thu Dec 19 09:35:01 CET 2019


>>>>> Jan Gorecki 
>>>>>     on Thu, 19 Dec 2019 11:49:11 +0530 writes:

    > Thank you Gabriel,
    > I agree that new behaviour makes much more sense. Just wanted to confirm
    > before resolving compatibility of my unit tests.
    > Best,
    > Jan

Indeed, Gabe's explanation is right-on-spot:  With the
generalization of head() / tail(), we really found it undesirable to
stay "internally inconsistent".

We do have to grab the chance for not-quite-back-compatible
improvements -- when the costs look comparably small --  for R 4.0.0.

Martin

    > On Wed 18 Dec, 2019, 10:46 PM Gabriel Becker, <gabembecker using gmail.com> wrote:

    >> Jan,
    >> 
    >> That is an intentional change as you can see in the documentation for
    >> head/tail in R-devel. Last time I discussed it with Martin, this behavior
    >> was desired and thus is unlikely to change unless "our" (ie his) mind does.
    >> 
    >> The hope is that the new behavior is actually what people would want (note
    >> it already behaves this way for data.frames and for matrices, which are now
    >> explicitly array objects with 2 dimensions as well as classed as matrices,
    >> so its more consistent now, and more reasonable for the object).
    >> 
    >> Best,
    >> ~G
    >> 
    >> On Wed, Dec 18, 2019 at 2:44 AM Jan Gorecki <j.gorecki using wit.edu.pl> wrote:
    >> 
    >>> Hi R-devel community,
    >>> 
    >>> I am aware of changes in R-devel in head/tail methods but I was not
    >>> expecting that to be a breaking change.
    >>> 
    >>> # R 3.6.1
    >>> ar = array(1:27, c(3,3,3))
    >>> tail(ar, 1)
    >>> #[1] 27
    >>> 
    >>> The current output of R-devel is something that I would expect from a
    >>> 
    >>> tail(ar, c(1, Inf, Inf))
    >>> 
    >>> or
    >>> 
    >>> tail(ar, c(1, NA, NA))
    >>> 
    >>> calls.
    >>> Is it going to stay like this or there are plans to mitigate this
    >>> breaking change?
    >>> 
    >>> # R-devel 2019-12-17 r77592
    >>> ar = array(1:27, c(3,3,3))
    >>> tail(ar, 1)
    >>> #, , 1
    >>> #
    >>> #     [,1] [,2] [,3]
    >>> #[3,]    3    6    9
    >>> #
    >>> #, , 2
    >>> #
    >>> #     [,1] [,2] [,3]
    >>> #[3,]   12   15   18
    >>> #
    >>> #, , 3
    >>> #
    >>> #     [,1] [,2] [,3]
    >>> #[3,]   21   24   27
    >>> 
    >>> Best,
    >>> Jan Gorecki
    >>> 
    >>> ______________________________________________
    >>> R-devel using r-project.org mailing list
    >>> https://stat.ethz.ch/mailman/listinfo/r-devel
    >>> 
    >> 

    > [[alternative HTML version deleted]]

    > ______________________________________________
    > R-devel using r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list