سؤال

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?

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top