You are here

The OpenMx website will be down for maintenance from 9 AM EDT on Tuesday, September 17th, and is expected to return by the end of the day on Wednesday, September 18th. During this period, the backend will be updated and the website will get a refreshed look.

foo[x,y] for MxMatrix objects

1 post / 0 new
mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
foo[x,y] for MxMatrix objects

It was suggested at last week's developers meeting that it could be useful to use the extract operator for MxMatrix objects. So I've implemented foo[x,y] and foo[x,y] <- z where 'foo' is a MxMatrix object. The new feature has been checked into the subversion repository.

Some notes about foo[x,y]

  • returns a MxMatrix object
  • applies [x,y] extraction to the components of foo (values, labels, free, lbound, ubound)
  • returns a MxMatrix of the same type as foo, unless that would cause an error. In cases of errors, return a Full matrix.
  • returns a MxMatrix with the same 'name' as foo. Use foo[x,y,name='bar'] to change the name of the return value.

Some notes about foo[x,y] <- z

  • z must be a MxMatrix object.
  • applies [x,y] replacement to the components of foo using the components of z
  • any dimnames of the right-hand side (z) are dropped. This is how R behaves on regular matrix objects
  • ignores the name of the right-hand side (z)