Am 14.03.2017 um 21:38 schrieb Allin Cottrell:
On Tue, 14 Mar 2017, Riccardo (Jack) Lucchetti wrote:

On Tue, 14 Mar 2017, Sven Schreiber wrote:

Couldn't lags() just be overloaded, such that for a matrix argument M: lags(p, M) equivalent to mlag(M, seq(1,p))

Now, THIS I like!

There's now a "mock-up" of this in git.

A question remains: what becomes of the optional third argument to lags()? In the series (or list) version, that option lets you arrange the output "by lag" rather than "by variable", while in mlag() the extra argument lets you specify a value other than zero for the missing elements. What should it do in the matrix-arg variant of lags?

I don't know, perhaps nothing? But keeping the ways of mlag() might also be good -- what exactly is the use case for the non-zero fill value for the missings? To put in an average of some sort?

cheers,
sven