Sunday, 15 February 2015

Custom R restart function that doesn't abort -


Apply invokeRestart ("muffleWarning") in muffleWarning

post text after

  e & lt; -expression (Warning ("Step 1", Instant. =) Correct Warning ("Step2", Instant. = TRUE)}) R & lt; Print (cum) # 1 invokeRestart ("mymuffleWarn", co)}), mymuffleWarn = function (co) print (conditionMessage (co)) with <>  - withRestarts (withCallingHandlers (eval (e), warning = function (cum) Code>  

I get the output (# 1 from) for the first warning but if I change mymufflewarn with mufflewarning all Outputs are printed (cum) (in invokeRestart ) .

Thanks

R indicates the source code:

  .signalSimpleWarning & lt; --internal (.dfltWarn (message, call)), muffleWarning = function () zero) -   

that is being asked from <

  static void vsignalWarning (SEXP call, constant four * format, va_list ap) {four buf [BUFSIZE]; SEXP Hooksim, HK, QCol; Huksim = Install ("Signalcumle Warning"); If (SYMVALUE (hooksym) = R_UnboundValue & amp ;! SYMVALUE (R_QuoteSymbol) = R_UnboundValue) {defense (qcall = LCONS (R_QuoteSymbol, LCONS (phone, R_NilValue))); Protection (hcall = LCONS (qcall, R_NilValue)); RVSN print (buff, buffetes - 1, format, ap); Hcall = LCONS (Mkstring (buff), hkol); Protection (hkol = lcns (hookusim, hkol)); Evil (HK, R_ Global ANV); Unsafe (3); } V WarningCol / Dfttt (call, format, AP); }   

which is called

That function is used to generate warnings in C code, and it is also called the do_warning which is a function which is WARNING < >

No comments:

Post a Comment