0

I have followed the instructions available in this website and I managed to create my own default R script for Rstudio. (Basically, I add a list some libraries that I usually use and then load them.) However, I would also like to have in this script a line informing when the file was first created (especifically, something like the result of format(Sys.time(), "%a %b %d %X %Y")) when I open a new script. Is it possible to do?

(For those who are familiar with the Spyder IDE for Python, you may recall that every new script includes its creation date inside the script. I want something analogous for my R script.)

When I open a new script in Rstudio, I would like to have the date of the creation already in the script, as below:

# -- coding: utf-8 --  
# Created on Fri Sep 17 2:07:05 PM 2021  
# author: DOS 
DOS
  • 29
  • 7
  • Possibly answered here? https://stackoverflow.com/questions/27066620/r-find-time-when-a-file-was-created – Phil Sep 17 '21 at 16:00
  • Thanks @Phil for the reply, but I think this is not what I'm looking for; sorry if I was not clear enough. I want the creation date to be automatically written in the body of the script. (I'm not looking for the metadata). For instance, when I open a new script in Rstudio, I would like to have the date of the creation already in the script as below: ``` # -*- coding: utf-8 -*- # # Created on Fri Sep 17 2:07:05 PM 2021 # # author: DOS ``` – DOS Sep 17 '21 at 17:12
  • I don't believe there's a ready way to do this without the user taking the step. I would recommend posting the suggestion as an issue here: https://github.com/rstudio/rstudio/issues – Phil Sep 17 '21 at 18:53
  • I see. Thanks for the recommendation. I'll try to post it as an issue. – DOS Sep 17 '21 at 23:39

0 Answers0