I have an RStudio project which contains several .R scripts and of course has a .Rproj file in the project folder. I was wondering if it is possible to automatically start one of these R scripts when I start the project by double clicking on the .Rproj project file?
When you say start a script, do you mean open the script to edit, or to actually execute the code in the script?
Jim, I mean execute the code in the script (its a shiny app).
Thanks
You could use an .Rprofile
file, and source()
the file that you want to run when you open the project. E.g. create an .Rprofile
file alongside your .Rproj
file, and inside that have something like:
source("path/to/your/script.R")
A word of caution would be that doing this risks making your later code/workflow less reproducible: if you rely on that script running then there is a risk things will break for you/other collaborators if that script doesn't get run.
Works great - Thanks Jim
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.