Now that the NEWS item is gone from "CHANGES IN R 4.5.2 patched", please also revert the change to 'Ops.ts' in R-4-5-branch, as I have mentioned. In R-4-5-branch, the change makes diff(m) inconsistent with m - lag(m, -1) for 1-row ts matrix m. Previously, neither of them was a matrix.
_______ On Monday, 23 February 2026 at 07:16:36 pm GMT+7, Martin Maechler <[email protected]> wrote: >>>>> Suharto Anggono Suharto Anggono via R-devel >>>>> on Sun, 22 Feb 2026 03:58:13 +0000 (UTC) writes: > diff(m, lag, dif) for matrix m now still returns > matrices, also when lag * dif > nrow(m) (PR#18972, thanks to > Mikael Jagan and Suharto Anggono). > diff(<ts-matrix>) remains matrix, even when it has length zero. > The above NEWS item has been moved to "CHANGES IN R 4.5.2 patched". > In fact, in R-4-5-branch, diff(m, lag, dif) for matrix m is still not a matrix when lag * dif > nrow(m) (see https://svn.r-project.org/R/branches/R-4-5-branch/src/library/base/R/diff.R for 'diff.default'; https://svn.r-project.org/R/branches/R-4-5-branch/src/library/base/R/datetime.R for 'diff.POSIXt'; https://svn.r-project.org/R/branches/R-4-5-branch/src/library/base/R/dates.R for 'diff.Date'; https://svn.r-project.org/R/branches/R-4-5-branch/src/library/stats/R/ts.R for 'diff.ts'). > And I suggest keeping it so. Because it has been like that simce the beginning, I think changing it in a patch release is not appropriate. We have ported bug fixes of "forever bugs" to the "R patched branch", before, quite on purpose. Typically they have been really rare use cases and for that reason probably were not detected and reported earlier... and we (R core) still thought these bugs should disappear as quickly as possible. For the above reason(s), I *had* actually planned to port this bug fix also to R "4.5.2 patched" ... But then it has become somewhat late to do the port only now, and R 4.5.3 will only be a "wrap up" release anyway.. Hence, I agree with your opinion and will now move the NEWS entry instead of porting the bug fix which was the original plan. Martin > What have been ported to R-4-5-branch are just- replacing 'tsLag' with 'lag' in 'diff.ts'- 'Ops.ts' to return matrix when e1 or e2 is matrix but e1 and e2 are not overlapping > I suggest reverting the port. A justification of diff(m) for 1-row ts matrix m not being a matrix was that m - lag(m, -1) was not a matrix. > Replacing 'tsLag' with 'lag' in 'diff.ts' is actually OK, but not necessary. [[alternative HTML version deleted]] ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
