如何配置 R 以将点文件存储在中央目录中
How to configure R to store dot files in central directory
我想将我的 R
点文件存储在一个中央目录中,类似于通过包含
使用 vim
存储备份和交换文件的方式
set backupdir=$HOME/.vim/backups//
在.vimrc
.
我的理由是,有时我想 运行* R
检查目录中的数据文件,我希望在这些目录中可以指望 every 目录中的文件是数据。结果是,如果我不小心保存了我的工作区,我必须记住删除 .Rhistory
等。我希望有一些方法可以配置 R
以便所有点文件都保存在 ~/R/workspace_images/
或类似的地方。
*:我 运行 R
来自命令行,而不是 RStudio,尽管我认为这不会有什么不同。
假设您在 linux,您可以设置一些环境变量来控制保存的位置和行数:
The (readline on Unix-alikes) history mechanism is controlled by two environment variables: R_HISTSIZE
controls the number of lines that are saved (default 512), and R_HISTFILE
(default ‘.Rhistory
’) sets the filename used for the loading/saving of history if requested at the beginning/end of a session (but not the default for loadhistory/savehistory). There is no limit on the number of lines of history retained during a session, so setting R_HISTSIZE
to a large value has no penalty unless a large file is actually generated.
我想将我的 R
点文件存储在一个中央目录中,类似于通过包含
vim
存储备份和交换文件的方式
set backupdir=$HOME/.vim/backups//
在.vimrc
.
我的理由是,有时我想 运行* R
检查目录中的数据文件,我希望在这些目录中可以指望 every 目录中的文件是数据。结果是,如果我不小心保存了我的工作区,我必须记住删除 .Rhistory
等。我希望有一些方法可以配置 R
以便所有点文件都保存在 ~/R/workspace_images/
或类似的地方。
*:我 运行 R
来自命令行,而不是 RStudio,尽管我认为这不会有什么不同。
假设您在 linux,您可以设置一些环境变量来控制保存的位置和行数:
The (readline on Unix-alikes) history mechanism is controlled by two environment variables:
R_HISTSIZE
controls the number of lines that are saved (default 512), andR_HISTFILE
(default ‘.Rhistory
’) sets the filename used for the loading/saving of history if requested at the beginning/end of a session (but not the default for loadhistory/savehistory). There is no limit on the number of lines of history retained during a session, so settingR_HISTSIZE
to a large value has no penalty unless a large file is actually generated.