2

I'm using R/R-Studio. Is there a possibility to automatically include always the same lines of code/comments when creating a new script?

Pang
  • 9,564
  • 146
  • 81
  • 122
Adam_Smith
  • 31
  • 3
  • "lines of code/comments" - do you mean load certain packages every time? Look into [.Rprofile](http://stackoverflow.com/questions/10300769) – zx8754 Jun 21 '16 at 06:56
  • Yes, for example. And adding the same comments at the start of the script every time. – Adam_Smith Jun 21 '16 at 06:57
  • Good question: How about author, created, ...? – Christoph Jun 21 '16 at 07:14
  • I would create a `template.R` and open it for new files, then `Save as`. – zx8754 Jun 21 '16 at 07:16
  • Same question, with no answer: http://stackoverflow.com/questions/35158708 – zx8754 Jun 21 '16 at 07:20
  • Thanks a lot, I go with the "snippet" solution, described under the following link provided by @zx8754 – Adam_Smith Jun 21 '16 at 08:44
  • There seems to be [nothing around](https://support.rstudio.com/hc/en-us/community/posts/200821846-Default-header-author-info-etc-) – Christoph Jun 21 '16 at 09:04
  • I just posted a solution using snippets [here](http://stackoverflow.com/questions/35158708/how-to-set-default-template-for-new-r-files-in-rstudio). I was not aware of @zx8754's comment. – Christoph Sep 02 '16 at 19:12

0 Answers0