rtist
As you abel said, you can simply try it.
However, although it works, it is usually not recommended. NA could have different types - a numeric NA, a character NA, etc. At the time you create this matrix, no specific type can be determined. Hence the system cannot allocate the require memory initially. If you know the matrix will be used to store numerical values, telling this to R explicitly will be more efficient: dat=matrix(0,2,2).
leffgh
可以这样的,好像matrix(NA,nc=2,nr=2)