fixInNamespace 对名为 x 的对象调用 edit 并指定修改后的对象代替原始对象。
getFromNameSpace搭配edit可以修改过软件的内置函数
Trace
trace(recover, sink)
trace(print, quote(if (is.numeric(x) && x >= 3) cat("hi\n")), print = FALSE)
## Tracing function "print" in package "base"
## [1] "print"
print(1)
## [1] 1
Chapter 11 Debugging R code | What They Forgot to Teach You About R (rstats.wtf)
print(3)
## hi
## [1] 3
# Use untrace to remove the tracing code
untrace(print)