Warnings thrown when accessing methods of referenc

2019-05-02 17:03发布

问题:

The code and the warnings:

tinyclass <- setRefClass("TinyClass", methods = list(doNothing=function(){}))
tc <- tinyclass()
tc$doNothing()
NULL
Warning messages:
1: In installClassMethod(value, self, field, selfEnv, thisClass) :
  method .objectPackage from class TinyClass was not processed into a class method until being installed.  Possible corruption of the methods in the class.
2: In installClassMethod(value, self, field, selfEnv, thisClass) :
  method .objectParent from class TinyClass was not processed into a class method until being installed.  Possible corruption of the methods in the class.

I also get this from the code supplied in the help page for setRefClass, and on any other class I try to make. I get it reliably on a Mac running R 3.2.2 which I installed myself, and intermittently on several real and virtual Windows 64 machines running R 3.2.1 which were installed by an IT department.

I am using RStudio 0.99.467. I have the following packages installed: datasets, graphics, grDevices, methods, stats, utils.

NEW INFO:

It seems that the problem occurs when I run the code through RStudio, but not through the native R gui.

Loaded packages in RStudio:

search() [1] ".GlobalEnv" "tools:rstudio" "package:stats" "package:graphics" "package:grDevices" "package:utils"
[7] "package:datasets" "package:methods" "Autoloads" "package:base"

Loaded packages in native R:

search() [1] ".GlobalEnv" "tools:RGUI" "package:stats" "package:graphics" "package:grDevices" "package:utils"
[7] "package:datasets" "package:methods" "Autoloads" "package:base"

Thoughts? Thanks