The following proposal would change the behavior of mxMatrix() in some circumstances based on the '`nrow`

' and '`ncol`

' arguments. This proposed is based on the following bug report: http://openmx.psyc.virginia.edu/issue/2010/07/matrix-not-populated-expected-r-based-nrow-ncol

Current behavior: if any of the arguments '`values`

', '`labels`

', '`free`

', '`fixed`

', '`lbound`

', or '`ubound`

' are matrices, then the arguments '`nrow`

' and '`ncol`

' are ignored. A warning is issued informing the user that the 'nrow' and 'ncol' arguments are ignored. All the matrices of the `MxMatrix`

object will end up with dimensions equal to the dimensions of the matrix that was passed.

Proposed behavior: if the values of '`nrow`

' and '`ncol`

' are specified, then they supersede the dimensions of any of the matrices passed into '`values`

', '`labels`

', '`free`

', '`fixed`

', '`lbound`

', or '`ubound`

'. All the matrices of the `MxMatrix`

object will end up with dimensions equal to '`nrow`

' and '`ncol`

'. A warning is issued if the data length is not a sub-multiple or multiple of the numbers of rows/cols.

PROs: mxMatrix() will mimic the behavior of matrix() with respect to the '`nrow`

' and '`ncol`

' arguments.

CONs: no warning is issued if '`values`

', '`labels`

', '`free`

', '`fixed`

', '`lbound`

', or '`ubound`

' are of different dimensions, but are sub-multiples or multiples of the numbers of rows/cols.

I think this makes sense, and that the pros outweigh the cons.

Another con is that some (probably very few) scripts' behavior may be changed, so I recommend that the documentation of mxMatrix notes that behavior has changed as of version x.x.xx.

I agree that the proposed behavior makes sense.

However, some people may have begun to rely on the previous behavior. This one is tricky and so I'd throw a warning at least for a few revs so that one can be alerted to the fact that argument precedence has changed.

Makes sense if nrow and ncol are provided, to be R-ish and pour and provided matrices into the mxMatrix...

My only comment would be that IF the user omits the nrow and ncol arguments, then a matrix provided for values or other layers of the mxMatrix datatype should be used to generate the mxMatrix dimensions.

Best of both worlds?

OK, I checked in the changes such that 'nrow' and 'ncol' supercede any matrix dimensions in the mxMatrix() function. If 'nrow' and 'ncol' are not specified, and matrix values are specified then those dimensions are used. In the case of missing 'nrow' and 'ncol', all the matrix values must be of equal dimensions. Keep an eye out for any bugs introduced by the change.