[Rd] stringsAsFactors and type.convert()
Martin Maechler
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Mon Apr 20 20:08:27 CEST 2020
>>>>> Arni Magnusson
>>>>> on Mon, 20 Apr 2020 16:50:16 +0000 writes:
> Dear Martin,
> Thank you for the well-reasoned response. I realized I was rather late to make this suggestion for 4.0.0, changing a somewhat low-level function that can indeed affect packages.
> I was just reviewing some R user scripts that were using type.convert(), mainly on data frames. In all cases, people were passing as.is=TRUE, so I was reminded that I would not be the only user who would appreciate if as.is=TRUE becomes the default at some point.
> So I am happy to hear that the help page now mentions that the as.is=TRUE is planned to be the default at some point in the future. Looking forward to the 4.0.0 official release - all positive changes!
Thank you, Arni.
Well, I did not reveal everything, rather
My current suggestion is to *change* the default,
but not to TRUE but rather if not specified to give a *warning*
which says it will use 'TRUE', but still a warning ...
along the line of the help page statement I mentioned (cited at the end below)
that callers really should always specify the 'as.is' argument
... which may be a good idea anyway, alerting the user when changing
default behavior.
> All the best,
> Arni
thank you, the same to you,
Martin
> ________________________________
> From: Martin Maechler <maechler using stat.math.ethz.ch>
> Sent: Monday, April 20, 2020 6:23:31 PM
> To: Arni Magnusson
> Cc: r-devel using r-project.org
> Subject: Re: [Rd] stringsAsFactors and type.convert()
>>>>> Arni Magnusson
>>>>> on Mon, 13 Apr 2020 22:20:19 +0000 writes:
>> If read.table() is defaulting to "character" instead of "factor" data type, shouldn't type.convert() also default to "character" in R 4.0.0?
>> This would seem like a good time to change the default to type.convert(as.is=TRUE), to align it with the new default in read.table and data.frame. I think many R >=4.0.0 users would be happy with as.is=TRUE as the default in type.convert.
>> I'm happy to work on the patch and run tests if that is helpful.
>> Cheers,
>> Arni
> Dear Arni,
> thank you for the notice, which unfortunately wasn't noticed
> (Easter break etc) and was too late in any case to fulfill the
> criterion of a small trivial bug fix for R 4.0.0 beta (very close
> to becoming RC (= "Release Candidate").
> Even when type.convert() may not be used much directly (but
> rather indirectly via read.table() where there's no problem), we
> found it too risky to destabilize the R 4.0.0 prereleases.
> As you all know there were ( / are?) still package changes
> needed and a few other important "todo"s, so we had to decide to
> postpone this (even for R-devel) to after releasing R 4.0.0
> coming Friday.
> I've committed a change to the help page which does mention that
> the default for 'as.is' is planned to be changed.
> Also, the help page's "Details" section, for a long time has
> ended with
> Since this is a helper function, the caller should always pass an
> appropriate value of 'as.is'.
> If useRs and package authors have followed this advice, they
> won't be bitten at all.
> Best regards,
> Martin
More information about the R-devel
mailing list