문제

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