Am 08.07.2019 um 09:00 schrieb Riccardo (Jack) Lucchetti:
On Mon, 8 Jul 2019, Sven Schreiber wrote:
> Am 08.07.2019 um 08:12 schrieb Riccardo (Jack) Lucchetti:
>> Thanks; besides, we could extend Sven's idea to mshape()
and make the
>> third argument optional (defaulting to 1, of course). Is this a good
>> idea?
>
> Not sure I like the default 1. If X has exactly r elements,
> mshape(X,r,1) can be easily achieved by vec(X), right? And it seems to
> me it is not a very standard case to use mshape(X,r,1) for r != nelem(X).
In fact, what I had in mind is the idiom "mshape(NA, r, c)", taht I use
a lot for initialising matrices.
Coming back to this use case: So apparently you often need to start with
a vector that does not hold zeros or ones. I wonder whether we could use
a dedicated function for that, like the 'empty' function in Numpy which
does just that. But maybe it's overkill.
BTW, I checked the expression "zeros(100,1) * NA" which still has all
zeros. Now I remember some dispute about the desired result for 0*NA,
but in any case the variant "zeros(100,1) .* NA" gives all 'nan', so
I'm
sure one of the two must be a bug.
cheers
sve