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.
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.
Clarifications:
Previous approach:
Thanks.
Use Windows Explorer (Finder on Mac) and navigate to the file BONUS/the_new_age. R . Now make RStudio the default application to open . R files (right click on the file Name and set RStudio to open it as the default if it isn't already)
Type the relevant R function calls into the text file. To run an R command, put the cursor on the line of the command and then click the Run button at the top of the file window. Or just press CTRL-Enter.
Creating an R script You can open a new empty script by clicking the New File icon in the upper left of the main RStudio toolbar. This icon looks like a white square with a white plus sign in a green circle. Clicking the icon opens the New File Menu.
Quite late and not really a template but I think the solution is close: go to
Tools => Global Options => Code => Tab Editing => Snippets "Edit Snippets".
Example:
snippet header2
# Author:
# Date: `r paste(date())`
# --------------
# Author:
# Date:
# Modification:
# --------------
If you then type header
{snippet} in a new script you get the text above with the date inserted automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With