4

The default R Notebook has a lot of prepopulated text. Is there a way to change this, so that when a new R Notebook is created, it is just a blank notebook?

Adam_G
  • 7,337
  • 20
  • 86
  • 148

1 Answers1

7

On my machine (OSX) I can edit the template r_markdown_notebook.Rmd found at this location:

/Applications/RStudio.app/Contents/Resources/resources/templates

On Windows look inside the RStudio folder:

C:\Program Files\RStudio\resources\templates

On Ubuntu/Mint (Linux), you will need sudo:

/usr/lib/rstudio/resources/templates
CoderGuy123
  • 6,219
  • 5
  • 59
  • 89
Martin Schmelzer
  • 23,283
  • 6
  • 73
  • 98
  • Check the RStudio program folder. There should be the folder called `Resources` as well. Or at least the `templates` folder. Just use the explorer to search for it in any case... – Martin Schmelzer Dec 26 '16 at 17:27
  • 1
    Found the PC location at `C:\Program Files\RStudio\resources\templates` – Adam_G Dec 26 '16 at 17:28
  • On the PC, it isn't letting me save changes to the file. Any idea why? I can start a separate question if necessary. – Adam_G Dec 26 '16 at 17:30
  • Answered my own question from here: https://technet.microsoft.com/en-us/library/cc753659(v=ws.11).aspx. Man, I do not love PCs... – Adam_G Dec 26 '16 at 17:38
  • Just for the record, the issue is due to newer Windows systems' permission restrictions on editing files in the system-related folders, including `Program Files`. To avoid this, save the template on the desktop/somewhere else, then copy it into the right folder. Windows will then complain that this action needs admin permissions, in which case you just click "ok", and it works. Alternative solution is starting RStudio with admin permissions. – CoderGuy123 May 18 '17 at 02:44
  • Does anyone know where to find the template in Linux? Also, can it be changed on a per-user basis? – mic Jun 14 '17 at 17:24
  • 4
    @mic I was looking for the same thing, and found it (Ubuntu 16.04) at `/usr/lib/rstudio/resources/templates`. Note you'll need `sudo` privileges to edit the files. Hope that helps – rosscova Jul 16 '17 at 07:58
  • @rosscova, thanks, that's exactly where it is. Unfortunately I do not have admin privileges (nor sudo) on the server, so either I search for a way to get it done at user level, or I ask my admin. Either way, thanks! – mic Jul 24 '17 at 11:06
  • In my case (OSX), the file to edit was called `notebook_osx.Rmd` and located at `/Applications/RStudio.app/Contents/Resources/app/resources/templates` – Slash Jun 04 '23 at 13:08