Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: mata: columns of different eltypes in a transmorphic matrix

From   Joe Canner <>
To   "" <>
Subject   st: RE: mata: columns of different eltypes in a transmorphic matrix
Date   Thu, 10 Oct 2013 01:50:47 +0000


As I understand it, transmorphic means that a matrix can take on one of a number of types (real, complex, string, or pointer), not that it can be comprised of multiple types.  This is useful for making functions that can handle different types of arguments, but is probably not helpful for what you want to do.

See here for an interesting discussion of the origins of transmorphic matrices in Mata: (I am assuming, absent evidence to the contrary, that Bill has not changed his mind about transmorphic matrices since 2006.)

As for the documentation, while it does specifically prohibit or discourage what you are trying to do,  it certainly does not give any reason to think that it is possible.

From: [] on behalf of László Sándor []
Sent: Wednesday, October 09, 2013 8:56 PM
Subject: st: mata: columns of different eltypes in a transmorphic matrix

Hi all,

I am confused by some behavior in StataMP 13 on my mac.

I am pretty sure that a transmorphic matrix can have columns (or
simply cells) of different types, as you can easily grab some Stata
data with  st_data and the resulting matrix will hold both strings and
reals according to your Stata variables.

But then I am not sure I understand why Stata complains about joining
transmorphic matrices into a transmorphic matrix if some of them
happen to hold reals and other strings. Why isn't this OK if I mean
the end result to hold cells of both types?

I tried to define a transmorphic placeholder first and fill in the
columns one by one, but if I start with (transmorphic colvectors
happening to be:) real colvectors the code breaks when I get to the
string colvector.

I don't see why this is invalid or why this limitation isn't better
documented. In any case, it would be nice to have a way around this.

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index