如何为新的“.R"设置默认模板rstudio 中的文件 [英] How to set default template for new ".R" files in rstudio

查看:47
本文介绍了如何为新的“.R"设置默认模板rstudio 中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:
我喜欢'r'.我使用 Rstudio - 这是一个不错的 IDE.我使用'r'的革命分析版本,革命R开放".

Background:
I like 'r'. I use Rstudio for it - it is a nice IDE. I use the revolution Analytics version of 'r', "revolution R Open".

我发现我经常在注释和结构化编程中输入相同的内容,我想省去重新输入的时间.

I find that I type the same stuff in the annotation and structured programming regularly, and I want to save myself the re-typing.

问题:
如何更改默认文件模板,以便在我在 Rstudio 中创建新的空白 R 脚本时出现我想要的已填充一些文本的模板.

Question:
How do I change the default file template so that the one I want, with some text already populated, comes up when I create a new blank R-script in Rstudio.

说明:

  • 我不希望这是一个手动过程,我打开一个文件,将其重命名为适当的目录,然后对其进行处理.我希望更改默认,以便自动发生这种情况.
  • I am not looking for this to be a manual process where I open one file, renaming it to a proper directory, and then work on it. I am looking to change the default so that this happens automatically.

以前的方法:

  • 谷歌
  • rstudio 搜索(示例)
  • 搜索堆栈溢出
  • 浏览 rstudio 菜单/首选项

谢谢.

推荐答案

使之成为可能 使用 rstudio v1.3 为多种文件类型定义用户和系统范围的模板

It was made possible to define user and system-wide templates for several file types with rstudio v1.3

一些问题:

  1. 有必要在 .config 目录中创建一个 'templates' 文件夹
  2. 特定文件类型必须根据 这个方案

因此,在这种情况下,创建一个名为 ~/.config/rstudio/templates/default.R/etc/rstudio/templates/default.R 的文件分别用于用户或系统范围的 .R 文件模板.

so, in this case, create a file called ~/.config/rstudio/templates/default.R or /etc/rstudio/templates/default.R for a user or system-wide .R file template, respectively.

我认为这是一个比接受的答案更少手动"的解决方案

I think this a 'less manual' solution than the accepted answer

这篇关于如何为新的“.R"设置默认模板rstudio 中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆