From henr|k@bengt@@on @end|ng |rom gm@||@com  Fri Nov 15 18:54:46 2019
From: henr|k@bengt@@on @end|ng |rom gm@||@com (Henrik Bengtsson)
Date: Fri, 15 Nov 2019 09:54:46 -0800
Subject: [Rd] _R_CHECK_LENGTH_1_LOGIC2_ setting and Rstudio ..
In-Reply-To: <24014.55669.55430.383436@stat.math.ethz.ch>
References: <CAPRVBcxsAkcgr3mDc4skTe8DTxJaYe2xyhk3QMk3odW1MGcyNA@mail.gmail.com>
 <CAPRVBczYZHO3JaFVfNeNNV0-YMRvX3CUYhUvLCjophDEoP+XgQ@mail.gmail.com>
 <23935.14449.965488.684663@stat.math.ethz.ch>
 <CAPRVBcwMY=GAVfFeCwowQsxP31Y=_B2ducosThN+8V91WESB8Q@mail.gmail.com>
 <20449_1568703158_x8H6qIDG009669_f8285123-371f-5d4b-1281-6cc085dba122@fredhutch.org>
 <22204_1568723392_x8HCSG3F015456_674779E0-B1F6-4DC2-9F1C-D5D48B044B66@mcmaster.ca>
 <AD725242-0FB7-4004-9F16-304E345A363A@mcmaster.ca>
 <23937.1791.389379.103733@stat.math.ethz.ch>
 <CAD4oTHF_e4rtHu0S5bUu38+kQSEHXwun3Sv9-CbK+xN9tSc2hA@mail.gmail.com>
 <CAD4oTHFf7Zp+Xe3jvv7oirLWgZm7ZiSNWZvbrEsqJGfrL6Q2wQ@mail.gmail.com>
 <23993.29737.690600.313456@stat.math.ethz.ch>
 <38105A28-07AE-48F6-A4A4-0C1FCCCBFBDC@gmail.com>
 <23995.62027.969336.196344@stat.math.ethz.ch>
 <CAD4oTHF1+PdJX-Qq=JZwafhGNatDu9AZVD0prCAvyJFL9bLzVg@mail.gmail.com>
 <24007.52264.596794.767557@stat.math.ethz.ch>
 <CABdHhvEzVtwajH3fRD_ZOzChf6kVr2j3j6dD-Uo2i92Vj9kTtQ@mail.gmail.com>
 <52b343f6-0861-ac16-4eff-c91d17501843@fredhutch.org>
 <24014.53971.84201.964445@stat.math.ethz.ch>
 <24014.55669.55430.383436@stat.math.ethz.ch>
Message-ID: <CAFDcVCRMT7qAXqEUXuZc820=1ns=_nRvZ7A06AJxyo-NByqrkQ@mail.gmail.com>

Yes, I ran into this too. I think they fixed it for RStudio 1.3
(https://github.com/rstudio/rstudio/pull/5457/files).  My workaround
is to enable these checks conditionally on not running R in the
RStudio Console (it works in the RStudio Terminal).  To test for the
RStudio Console, you need to turn to .Rprofile rather than .Renviron,
e.g.

## Strict run-time checks, unless in the RStudio Console
if (Sys.getenv("RSTUDIO") != "1" || nzchar(Sys.getenv("RSTUDIO_TERM")) {
  Sys.setenv(
    "_R_CHECK_LENGTH_1_CONDITION_" = "true",
    "_R_CHECK_LENGTH_1_LOGIC2_" = "verbose"
  )
}

FWIW, for those who use 'startup::startup()` in ~/.Rprofile, the above
can also be done by having a file named (exactly)
'.Renviron.d/strict,rstudio=FALSE' containing:

_R_CHECK_LENGTH_1_CONDITION_=true
_R_CHECK_LENGTH_1_LOGIC2_=verbose

startup() will only process this file when R is *not* running in the
RStudio Console (`rstudio=FALSE`).

/Henrik

On Fri, Nov 15, 2019 at 9:00 AM Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>
> >>>>> Martin Maechler
> >>>>>     on Fri, 15 Nov 2019 17:31:15 +0100 writes:
>
>     > as ((strongly recommended by me for package developers !))
>
>     > _R_CHECK_LENGTH_1_CONDITION_=true
>     > _R_CHECK_LENGTH_1_LOGIC2_=verbose
>
> Apropos, for many months now, when very occasionally using
> Rstudio (notably for teaching to beginners),
> I've needed to use a wrapper shell script *unsetting* these,
> because otherwise I've got "a bomb" from trying to run Rstudio,
> as it internally uses code that fails when
>  _R_CHECK_LENGTH_1_LOGIC2_
> is activated, see the screen shot (from the very latest
> Rstudio 1.2.5019),
> at least in my case where I use a non-trival  'options(repos = ..)'
> in my startup.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] _R_CHECK_LENGTH_1_LOGIC2_ setting and Rstudio ..
Henrik Bengtsson