On Sun, 1 Nov 2020, Sven Schreiber wrote:
Am 01.11.2020 um 21:49 schrieb Allin Cottrell:
> On Sun, 1 Nov 2020, Allin Cottrell wrote:
> Ah, I now remember what this was about. We shouldn't do it without the
> user setting a special option (not available yet), but here's the deal.
> Suppose I have an array of strings of length equal to the length of the
> dataset (most likely, with repetition) and I want to impose these on a
> "blank slate" series -- perhaps all NAs.
Although the doc currently says the target series must have all positive
integers. I guess this was implicitly meant as "...or be missing" ?
Well, the all NAs case was not even thought of when the doc was
written.
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?
Allin