Hi Martin,
It kind of does make sense to issue the warning when **recycling** (and
this is consistent with what happens with recycling in general):
> matrix(1:4, 6, 6)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,]131313
[2,]242424
[3,]3
Hi Martin
Thank you! I very much understand your reservations and know it was a bit
cheeky to poke.
I agree that in those cases where my (naive) patch results in two warnings,
keeping only the new one would better.
No strong opinion about the case where either ncol or nrow is 0. Maybe a
> Wolfgang Huber
> on Sat, 6 Feb 2021 19:49:11 +0100 writes:
> FWIW, I paste below a possible change to the warnings generating part of
the do_matrix function in R/src/main/array.c that adds the kind of warning that
Abby is asking for, and that IMHO would more often help users
FWIW, I paste below a possible change to the warnings generating part of the
do_matrix function in R/src/main/array.c that adds the kind of warning that
Abby is asking for, and that IMHO would more often help users find bugs in
their code than interfere with intended behaviour.
> matrix (1:6,
So, does that mean that a clean result is contingent on the length of
the data being a multiple of both the number of rows and columns?
However, this rule is not straightforward.
> #EXAMPLE 1
> #what I would expect
> matrix (1:12, 0, 0)
<0 x 0 matrix>
Warning message:
In matrix(1:12, 0, 0) :
> Abby Spurdle (/əˈbi/)
> on Mon, 1 Feb 2021 19:50:32 +1300 writes:
> I'm a little surprised that the following doesn't trigger an error or a
warning.
> matrix (1:256, 8, 8)
> The help file says that the main argument is recycled, if it's too short.
> But doesn't
I'm a little surprised that the following doesn't trigger an error or a warning.
matrix (1:256, 8, 8)
The help file says that the main argument is recycled, if it's too short.
But doesn't say what happens if it's too long.
__
R-devel@r-project.org