On Tue, Nov 14, 2023 at 11:48 AM Riccardo (Jack) Lucchetti
<p002264(a)staff.univpm.it> wrote:
On 14/11/2023 16:24, Allin Cottrell wrote:
> This is somewhat related to recent discussion of "Binary Logit with
> string series".
>
> As you may know, when gretl reads string-valued series from (e.g.) a CSV
> file, consecutive 1-based numeric codes are attached to the strings in
> their order of occurrence. In some cases that's fine, but if the string
> values have a "natural" ordering it may not be so fine.
[...]
> On importing these data "high" will get code 1, "low" code 2,
and so on.
> One may want to recode income as low=1, middle=2, high=3, and also
> recode working as no=1, yes=2. That's not super difficult in hansl, but
> I wonder if it would be worthwhile to provide a built-in function to do
> the job: this could be a new function, or perhaps could be enabled as a
> variant of strvsort(), via an optional second argument.
I like the idea of giving a second argument to strvsort(), in the
interest of keeping the namespace as compact as possible.
Agreed. Now in git the function I envisaged is enabled as a variant of
strvsort. That means that, like the original strvsort, it modifies a
string-valued series in place rather than returning a new series.
Allin