3 Comments
访客 *Shrek, Tan* @ 2018-01-07 22:13:14 写道:
前两周鼓捣了两个小时最后放弃的问题,居然不小心在这看到了答案。真是踏破铁鞋无觅处,得来全不费功夫。
哈哈,这么巧?!
——原帖发布于 2018-01-08 01:15:13
访客 *Shrek, Tan* @ 2018-01-08 15:43:39 写道:
对啊,不过没成功,放弃了,貌似试了eval(quote(on.exit(xxx, add = TRUE)), envir = parent.frame()),但行不通…看来还得加强学习~~~
Guest *Michael Chirico* @ 2018-02-20 16:34:41 originally posted:
awesome, genius use of do.call. shame on.exit doesn't have an envir argument itself. this is quite useful for tidyverse where everything is buried 6 layers deep of functions and i want to on.exit the main function :)
I'm a bit confused how when f on.exits, it knows what x is though...
Guest *elr* @ 2019-09-15 18:44:16 originally posted:
Thanks for this very useful post!
Any thoughts on making above script also work in a Markdown R chunk? Looks like knitr causes on.exit to run immediately :
- running g() in an R script :
[1] "exiting g()"
- running g() in a Markdown R chunk with knitr :
g()
[1] "exiting g()"
[1] "an exit call added to f() by g()"
Sign in to join the discussion
Sign in with GitHub