Am 01.11.2020 um 22:44 schrieb Allin Cottrell:
On Sun, 1 Nov 2020, Sven Schreiber wrote:
> Am 01.11.2020 um 21:49 schrieb Allin Cottrell:
> Then I could do
>>
>> stringify(x, S, <some option>)
>>
>> and I'd get a series with m distinct values, where m is the number of
>> distinct strings in S, with numeric codes set to match. Basically it's a
>> third way to create a string-valued series, besides importation from a
>> suitable file and stringification of a series that already holds
>> suitable numeric codes.
>
> Perhaps this could be achieved without an extra option - again, the doc
> says all positive integers for normal use; so perhaps if x is a
> zero-valued series this could be taken to mean this alternative usage.
Good idea. We could do that if we reckon it's worthwhile. Any takers for
the idea?
Well, basically if I understand correctly some way is wanted to create a
string-valued series without reading in a file. Then I guess the most
straightforward syntax approach would be to allow a strings array
directly in a genr-type context, like this:
series s = defarray("hey", "ho", "aha")
which would work if $nobs equals the length of the array, otherwise
provoke an error just like in a matrix-based context. No need to
complicate things (from the user's point of view) by going through an
artificial stringify function call.
This feels natural to have when string-valued series are supported, but
OTOH the support in gretl has been growing gradually, so doesn't
necessarily have to be rushed.
cheers
sven