On Mon, 7 Jul 2008, Gordon Hughes wrote:
Is there an internal flag that is accessible to a user written
function that specifies the type of dataset being used - eg
cross section, time series, panel? If the panel command is
issued for a time series dataset, it generates an error message
saying (roughly) that the command is only valid for a panel
dataset.
I would like to be able to carry out the same test in a function
so as to terminate the function in an informative manner rather
than generating potentially confusing messages from internal
commands. I thought about testing $unit but that generates its
own message if the dataset is not a panel.
As Sven mentioned, there's a mechanism in place for specifying the
sort of data that are required by a gretl function package.
However, what you're suggesting sounds useful. In CVS, I've added
an accessor, $datatype, which yields an integer value as follows:
0 no dataset
1 cross-sectional data
2 time-series data
3 panel data
It may be worth adding symbolic names for these values, e.g.
0 = DATA_NONE
Allin.