On Sun, 7 Mar 2021, Sven Schreiber wrote:
Hi,
this question is prompted by the very recent tip for the aggregate()
function that the position of the count column is at nelem(byvar) + 1.
(Where the "byvar" name stems from the help text.)
[... example follows ...]
I understand that nelem() on a series is ambiguous, because it could
be
understood to mean the observations, like in nelem({x}). But we also
have the nobs() function for that.
In the light of this, I'd say nelem() for series doesn't sound like a good
idea. We always have typeof() if a check is needed, as in
nx = (typeof(x) == 2) ? 1 : nelem(x)
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------