Skip to content
Prev 59468 / 63430 Next

surprised matrix (1:256, 8, 8) doesn't cause error/warning

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 compromise would be to live with the inconsistency of only warning if length(data)>1, in order to allow legacy code such as  matrix(NA, 0, 3). Assuming that the main objective is not consistency but more robust users? R code.

Btw if one were to refactor this properly (which I do not propose!), shouldn?t `matrix` just be a wrapper to `array`, whose added value is the inference of missing `nrow` and `ncol` values and dealing with `byrow`?

	Kind regards, and thanks again	
		Wolfgang