[Rd] Intermittent crashes with inset `[<-` command

Gabriel Becker g@bembecker @end|ng |rom gm@||@com
Wed Feb 27 09:19:35 CET 2019


Hi Brian,

I don't have a windows machine, but on a modern macbook pro I'm not able to
get this to crash in 3.5.1 or a very recent built-from-source R-devel.  I
increased the length of x by 2 orders of magnitude but that just made the
loop take a lot longer to successfully run in both R versions i tested.

So seems like there is some OS/machine dependency at work here (?).

Best,
~G

On Wed, Feb 27, 2019 at 12:01 AM Brian Montgomery via R-devel <
r-devel using r-project.org> wrote:

> The following code crashes after about 300 iterations on
> my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.
> Others have duplicated this (see
> https://github.com/tidyverse/magrittr/issues/190 if necessary), but I
> don't know how machine/OS-dependent it may be.
> If it doesn't crash for you, please try increasing the length of the x
> vector.
>
> Substituting the commented-out line for the one below it works correctly
> (prints out 1:1000 and ends normally) every time.
>
> x <- 1:200000
> y <- rep(letters[1:5], length(x) / 5L)
> for (i in 1:1000) {
>   # x[y == 'a'] <- x[y == 'b']
>   x <- `[<-`(x, y == 'a', x[y == 'b'])
>   cat(i, '')
> }
> cat('\n')
>
> The point of using this syntax is to make it work better with pipes, but
> the errors occur without pipes or magrittr.
>
> Thank you for your help!
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



More information about the R-devel mailing list