[Rd] _R_CHECK_LENGTH_1_LOGIC2_ setting and Rstudio ..

Henrik Bengtsson henr|k@bengt@@on @end|ng |rom gm@||@com
Fri Nov 15 18:54:46 CET 2019


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 using 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 using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list