0

warning() seems to be ignored in reference class methods, although stop() seems to work. That is,

TestA <- setRefClass("TestA", 
                methods = list(
                    warnMe = function() warning("Warn!!!"),
                    stopMe = function() stop("Stop!!!")
                )
            )
obj <- TestA()

obj$warnMe()
obj$stopMe()

yields only:

Error in obj$stopMe() : Stop!!!

Is this intentional and if so, why? How am I supposed to raise warnings inside class methods?

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
mchen
  • 9,808
  • 17
  • 72
  • 125

1 Answers1

0

Make sure warnings are turned on options(warn=1). – Matthew Plourde

mchen
  • 9,808
  • 17
  • 72
  • 125