• R语言
  • 你值得拥有: 保存R运行历史的代码到用户目录下的.Rhistory

由.zhistory想到的.查了一下,发现直接有代码. 大家睡前不妨优化一下这段代码,如加上日期时间,排除重复。

In the shell or .zshrc:

<br />
export R_HISTFILE=~/.Rhistory<br />


in .Rprofile:
<br />
.Last <- function() {<br />
        if (!any(commandArgs()=='--no-readline') && interactive()){<br />
                require(utils)<br />
                try(savehistory(Sys.getenv("R_HISTFILE")))<br />
        }<br />
}<br />
</p>

ref: http://stackoverflow.com/questions/1189759/expert-r-users-whats-in-your-rprofile