除了通过重定向捕获整个会话之外,有没有办法在R会话期间启动和停止记录?为了澄清,我正在寻找与log using
Stata中的命令类似的东西.
为了完成使用水槽的答案
# copy the log to a text file
sink("./logofcode.txt")
Your R code(s) goes here
you can use a stored R code as well using source()
source("./XS_SPEC_CF.R",echo=T, max.deparse.length=1e3)
sink()
Run Code Online (Sandbox Code Playgroud)