On Wed, 4 Jan 2017, Pedro Bação wrote:
Hello,
Is there a Gretl function will that tell us what is the type of the
variable given as argument? If not, is there a way of getting that sort of
information in Gretl?
In fact there is such a function, but for some reason it has never
been documented -- I'm in the process of amending that. The function
is named "typeof": it takes a putative identifier as argument and
returns a numeric code, as described in the help for the "inbundle"
function. To illustrate:
<hansl>
open data4-1
matrix m
eval typeof(sqft)
eval typeof(m)
eval typestr(typeof(m))
eval typeof(nothing)
</hansl>
This gives the output
2
3
matrix
0
Having this function makes the (documented) "exists" function
somewhat redundant. In fact, internally I'm making "exists" into an
alias for "typeof".
Allin Cottrell