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: > counttt [1] 0 > str(df) 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 > counttt [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 <ruipbarra...@sapo.pt> wrote: > > Hello, > > Inline. > > Às 14:26 de 15/07/19, Duncan Murdoch escreveu: > > On 15/07/2019 8:57 a.m., Rui Barradas wrote: > >> Hello, > >> > >> Clean R 3.6.1 session on Ubuntu 19.04, RStudio 1.1.453. sessionInfo() at > >> the end. > > > > That's not what I'd call a "clean session" with all those packages loaded: > > You are right, but when I wrote that it *was* clean. Then, for some > reason I don't understand, RStudio loaded them all. Guess I'll have to > check what is going on here. > > > > >> loaded via a namespace (and not attached): > >> [1] sos_2.0-0 nlme_3.1-140 matrixStats_0.54.0 > >> [4] fs_1.2.7 xts_0.11-2 usethis_1.5.0 > >> [7] lubridate_1.7.4 devtools_2.0.2 RColorBrewer_1.1-2 > >> [10] rprojroot_1.3-2 rbenchmark_1.0.0 tools_3.6.1 > >> [13] backports_1.1.4 R6_2.4.0 rpart_4.1-15 > >> [16] Hmisc_4.2-0 lazyeval_0.2.2 colorspace_1.4-1 > >> [19] nnet_7.3-12 npsurv_0.4-0 withr_2.1.2 > >> [22] tidyselect_0.2.5 gridExtra_2.3 prettyunits_1.0.2 > >> [25] processx_3.3.0 curl_3.3 compiler_3.6.1 > >> [28] cli_1.1.0 htmlTable_1.13.1 randomNames_1.4-0.0 > >> [31] dvmisc_1.1.3 desc_1.2.0 tseries_0.10-46 > >> [34] scales_1.0.0 checkmate_1.9.1 lmtest_0.9-36 > >> [37] fracdiff_1.4-2 mvtnorm_1.0-10 quadprog_1.5-6 > >> [40] callr_3.2.0 stringr_1.4.0 digest_0.6.18 > >> [43] foreign_0.8-71 rio_0.5.16 base64enc_0.1-3 > >> [46] stocks_1.1.4 pkgconfig_2.0.2 htmltools_0.3.6 > >> [49] sessioninfo_1.1.1 readxl_1.3.1 htmlwidgets_1.3 > >> [52] rlang_0.3.4 TTR_0.23-4 rstudioapi_0.10 > >> [55] quantmod_0.4-14 MLmetrics_1.1.1 zoo_1.8-5 > >> [58] zip_2.0.1 acepack_1.4.1 dplyr_0.8.0.1 > >> [61] car_3.0-2 magrittr_1.5 Formula_1.2-3 > >> [64] Matrix_1.2-17 Rcpp_1.0.1 munsell_0.5.0 > >> [67] abind_1.4-5 stringi_1.4.3 forecast_8.6 > >> [70] yaml_2.2.0 carData_3.0-2 MASS_7.3-51.3 > >> [73] pkgbuild_1.0.3 plyr_1.8.4 grid_3.6.1 > >> [76] parallel_3.6.1 forcats_0.4.0 crayon_1.3.4 > >> [79] lattice_0.20-38 haven_2.1.0 splines_3.6.1 > >> [82] hms_0.4.2 knitr_1.22 ps_1.3.0 > >> [85] pillar_1.4.0 pkgload_1.0.2 urca_1.3-0 > >> [88] glue_1.3.1 lsei_1.2-0 babynames_1.0.0 > >> [91] latticeExtra_0.6-28 data.table_1.12.2 remotes_2.0.4 > >> [94] cellranger_1.1.0 testthat_2.1.0 gtable_0.3.0 > >> [97] purrr_0.3.2 assertthat_0.2.1 ggplot2_3.1.1 > >> [100] openxlsx_4.1.0 xfun_0.6 survey_3.35-1 > >> [103] survival_2.44-1.1 timeDate_3043.102 tibble_2.1.1 > >> [106] memoise_1.1.0 cluster_2.0.8 toOrdinal_1.1-0.0 > >> [109] fitdistrplus_1.0-14 brew_1.0-6 > >> > >> > > > > However, even when I load almost all of those, I don't see the problem. > > I've got the same R version, and a newer Rstudio version (mine is > > 1.2.1335 on a Mac). I couldn't load ] "latticeExtradata.table" and > > "fitdistrplusbrew", and I didn't check my package versions against yours. > > > > I'd suspect the issue is with RStudio somehow, because it needs to do a > > lot to maintain its environment view. Do you see this when running R > > from the command line? > > > > Duncan Murdoch > > > > It's a RStudio thing. > Tested with > > Rscript --vanilla test.R > > > the result is the expected one. > (test.R has the obvious contents.) > > > Rui Barradas > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel