Skip to content
Prev 57205 / 63421 Next

Possible bug in `class<-` when a class-specific '[[.' method is defined

When RStudio builds the Environment pane, it will evaluate some R code
on objects in your global environment (as you have seen). In
particular, for better or worse, it calls `str()` on objects in the
global environment, to get a short text summary of the object.

So, to reproduce what you're seeing in a plain R session, you can check:
[1] 0
Classes 'MYCLASS' and 'data.frame':     5 obs. of  4 variables:
 $ V1: int  1 2 3 4 5
 $ V2: int  6 7 8 9 10
 $ V3: int  11 12 13 14 15
 $ V4: int  16 17 18 19 20
[1] 9

Newer versions will allow you to disable the Environment pane if you
so desire, since calling `str()` can have these kinds of undesirable
side effects in some cases.

In general though, if you're reporting a bug in R (as opposed to
RStudio) it's best to verify that you can reproduce the issue in a
'plain' R session (e.g. in the terminal) to be absolutely sure you're
seeing an R issue as opposed to an RStudio issue, as I imagine the
last thing R Core wants to do is spend time tracking down an issue
only to find it was in RStudio rather than R itself...

If you want to follow up further with the RStudio team I'd recommend
making a post at https://community.rstudio.com/c/rstudio-ide.

Thanks,
Kevin
On Mon, Jul 15, 2019 at 7:59 AM Rui Barradas <ruipbarradas at sapo.pt> wrote: