[Rd] Better 'undefined columns' error for data.frame
GILLIBERT, Andre
Andre@G||||bert @end|ng |rom chu-rouen@|r
Sun Sep 25 20:09:39 CEST 2022
Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
> On 24/09/2022 9:56 a.m., GILLIBERT, Andre wrote:
> > Dear R developers,
> >
> >
> > One of the error messages that make me loose the most time is the "undefined columns selected" of `[.data.frame`.
> >
> > It ought to specify the list of bad column names, but currently does not.
> >
> > Fortunately, this can easily be fixed by a small patch I can write.
> >
> >
> > Are you interested in that patch?
>
> I doubt if you'll get an answer to this without showing it to us.
>
> > Is there a standard way to transfer patches for feature requests?
>
> The standard instructions are here: https://www.r-project.org/bugs.html .
> You're offering an enhancement rather than a bug fix, but the process is
> the same. But since your change is probably quite small, you might not
> need to go through the whole process: proposing it on this mailing list
> might be sufficient.
>
> Duncan Murdoch
Please, find the patch attached, based on the latest R SVN trunk code.
In order to avoid any accidental modification of the behavior of `[.data.frame`, I only inserted code at positions where the "undefined columns selected" error was generated.
In order to test all code paths, I wrote a small test script (code attached), but did not insert clean & standardized tests to the R build.
I added a new base::.undefined_columns_msg closure. I am not sure that adding such new internal symbols to the base package is smart because it pollutes the base environment, but looking at the base-internal documentation page, it seems to be standard practice.
For message translations, I tried to use tools::xgettext() to re-generate the R-base.pot file, but this file seems to be out of sync for a few messages. So, I manually added the new messages to R-base.pot.
As I am a native french speaker, I added appropriate translations to R-fr.po.
The make command did not regenerate .mo files, and I did not find any appropriate make target to rebuild them, so, for testing purposes, I manually generated them. The R installation & administration manual did not help (https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Localization-of-messages).
When compiling the source code on a x86_64 Ubuntu 16.04 system, I got a problem with position independent code in the internal R LAPACK module. The -fPIC option was not properly passed to the gfortran command line. I fixed that by replacing $(ALL_FCFLAGS) by $(ALL_FFLAGS) on line 16 of src/modules/lapack/Makefile.in
That looks like a bug to me (misspelling of FFLAGS), but I did not fix that in my patch, since it is a very different issue.
--
Sincerely
André GILLIBERT
More information about the R-devel
mailing list