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.
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

Reply via email to