nanxstats / blog-comments

utterances comments
0 stars 1 forks source link

blog/post/disposable-computing-with-callr/ #7

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Disposable Computing with callr - Nan Xiao | 肖楠

Use callr to work around manual connection management.

https://nanx.me/blog/post/disposable-computing-with-callr/

nanxstats commented 3 years ago

Comment written by Yihui Xie on 2020-04-13 01:55:56

It happens that I also needed something similar to callr::r() yesterday before I saw your post, and I implemented it via Rscript: https://github.com/yihui/xfun/commit/7118932 I don't know how it was implemented in callr (sounds like too much magic to me), but I guess my simple implementation (16 lines of code in total without counting comments, and with no dependencies) is sufficient for most cases when you need to call a function in a new R session.

nanxstats commented 3 years ago

Comment written by Nan Xiao on 2020-04-13 03:10:29

Just about time! Rscript() is very much adequate for such purposes --- I believe callr is a fancy/managed version of Rscript() with some options for context handling and output redirection, although that's probably an oversimplification of the engineering efforts made behind the scenes...