Hello Community!
I really enjoy the new project templates and want to use them for an existing project I am contributing to. https://github.com/benmarwick/rrtools .The project templates idea fit the package philosophy very well,
My issue is that rrtools has a two-step approach to package creation and I cannot get this to fully impliment with the project template approach; I hope to address this issue.
Simply, the rrtools approach is to:
- run a function
use_compendium(path) from command line of IDE that creates an R package in a given directory; then spawn a new Rstudio session for the package.
- within the new Rstudio session run additional functions to define the project (e.g. use_github(x,y), use_travis(x,y,z), etc...).
I want to define these parameters (x,y,z) as options in the project template and have them help control project setup in the newly created package session.
The issue is that the project template can create the package and spawn a new Rstudio session for that package, but cannot then execute the subsequent functions to further setup the package. In your examples for templates, I can write the INDEX file to the project/package directory and cat() the options from the template UI, but I have no means of executing functions based on those options.
One approach I am working towards is to have the function bound to project template (e.g. hello_world()) write .Rprofile instead INDEX and use the options from the template UI as arguments in the subsequent functions:
if(isTRUE(dots[["checkInput_Travis"]])){
use_travis(dots[["selectInput_TravisOptions"]])
}
I am unable to fully test this at the moment, but I think it will (may?) work.
Questions:
- Is there a better way to do this?
- If the .Rprofile ideas does work, is there a way to rename/delete .Rprofile after it is executed the first time the project is loaded?
Thank you for any clarity or help that the community can provide!
Matt