[Rd] as-cran issue ==> set _R_CHECK_LENGTH_1_* settings!

Avraham Adler @vr@h@m@@d|er @end|ng |rom gm@||@com
Mon Jan 13 20:38:12 CET 2020


Those of us stuck on Windows but who attempt to develop properly are
wounded to the quick, sir!

:)

Avi

On Mon, Jan 13, 2020 at 12:24 PM Martin Maechler <maechler using stat.math.ethz.ch>
wrote:

> >>>>> Ben Bolker
> >>>>>     on Mon, 13 Jan 2020 11:49:09 -0500 writes:
>
>     > From R NEWS (changes in 3.6.0)
>     > Experimentally, setting environment variable
> _R_CHECK_LENGTH_1_LOGIC2_
>     > will lead to warnings (or errors if the variable is set to a ‘true’
>     > value) when && or || encounter and use arguments of length more than
> one.
>
> Indeed,  thank you, Ben.
>
> Note (Dirk) this is not just something
>   "by Henrik (..) as he tried to convince us all to use it more"
>
> I've activated this (and the other
>   _R_CHECK_LENGTH_1_CONDITION_ ! )
> for years (maybe not many years, it just feels like it), and *EVERY TIME*
> it triggers, it's been revealing a programmeR's thinko / bug / ..,
> something where the code was clearly suboptimal and should've been
> improved.
> (Unfortunately, the bug has often been in packages, and sometimes I had to
>  disable the setting when I wanted that "buggy" package to work ..)
>
> Occasionally being puristic, let me state this:
>    __________________________________________________________________
>   /------------------------------------------------------------------\
>   |                                                                  |
>   | Every careful R programmer should use (something like "true",    |
>   | "verbose", or even package=... )                                 |
>   |                                                                  |
>   | export _R_CHECK_LENGTH_1_CONDITION_=true                         |
>   | export _R_CHECK_LENGTH_1_LOGIC2_=verbose                         |
>   |                                                                  |
>   | in her/his ~/.profile equivalent (*)                             |
>   \__________________________________________________________________/
>
>
> *) well assuming a careful R programmer would never develop on
>    Windows anyway (where you need different means to set such
>    environment variables).
>
>
>
>     > On 2020-01-13 11:46 a.m., Therneau, Terry M., Ph.D. via R-devel
> wrote:
>     >> Thanks for the feedback Dirk.   I sent my follow-up before I saw it.
>     >>
>     >> Looking at the source code, it appears that there is no options()
> call
>     >> to turn this on. Nor does "R --help" reveal a command line option.
>     >> How then does a user turn this on outside of the R CMD check
>     >> envirionment, so as to chase things like this down?
>     >>
>     >> The fact that 1. renaming my function makes the error go away, 2. my
>     >> function is just a wrapper to inherits(), and 3. its a new error in
> code
>     >> that hasn't changed, all point me towards some oddity with the check
>     >> function.
>     >>
>     >> Terry
>     >>
>     >>
>     >> On 1/13/20 10:22 AM, Dirk Eddelbuettel wrote:
>     >>>
>     >>> On 13 January 2020 at 10:02, Therneau, Terry M., Ph.D. via R-devel
> wrote:
>     >>> | Where can I find out (and replicate) what options as-cran turns
> on?
>     >>>
>     >>> See the file src/library/tools/R/check.R in the R sources, and
> grep for
>     >>> as_cran which is the internal variable controlled by the --as-cran
> option
>     >>>
>     >>> [...]
>     >>>
>     >>> | The check log contains multiple instances of the lines below:
>     >>> |
>     >>> | < Warning message:
>     >>> | < In if (ismat(kmat)) { :
>     >>> | <   the condition has length > 1 and only the first element will
> be
>     >>> used
>     >>> |
>     >>> | I don't see how the error could arise, but if I know what
> as-cran is
>     >>> doing perhaps I can
>     >>> | replicate it.
>     >>>
>     >>> This was widely discussed on this list and should also be in the
> NEWS
>     >>> file.
>     >>>
>     >>> The change is about what the message says: the if () tests a scalar
>     >>> logical,
>     >>> it appears that ismat(kmat) returns more than a scalar.
>     >>>
>     >>> There has always been an opt-in for this to error -- cf many
> messages
>     >>> by Henrik
>     >>> over the years as he tried to convince us all to use it more.
>     >>>
>     >>>
>     >>> Dirk
>     >>>
>     >>
>     >> ______________________________________________
>     >> R-devel using r-project.org mailing list
>     >> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>     > ______________________________________________
>     > R-devel using r-project.org mailing list
>     > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
-- 
Sent from Gmail Mobile

	[[alternative HTML version deleted]]



More information about the R-devel mailing list