In R, I can create a matrix with matrix()
, which has the function definition:
function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL)
{ ... }
This suggests that the default value for number of rows (nrow
) and columns (ncol
) are 1.
So why does the following break? Why does specifying the same default values of 1
result in a different matrix?
> matrix(1:9)
[,1]
[1,] 1
[2,] 2
[3,] 3
[4,] 4
[5,] 5
[6,] 6
[7,] 7
[8,] 8
[9,] 9
> matrix(1:9, ncol=1, nrow=1)
[,1]
[1,] 1