R/project_management.R
setup_analysis_project.Rd
This sets up simple folder structure and template files for an analysis project.
The structure is based on https://towardsdatascience.com/how-to-keep-your-research-projects-organized-part-1-folder-structure-10bd56034d3a, with some simplifications and additions.
Root folder of the project to be set up. Defaults to here::here()
Character vector of analysis steps. R files will be set up in order.
Name of folder for outputs from each analysis step
Logical. Should code files be placed in /code sub-folder? Otherwise, are placed in root folder
Character vector of packages to be loaded at start of each analysis file.
Character vector of packages to be loaded and installed from Github if needed at start of each analysis file.
The template includes two helpers worth highlighting. The take_note()
function allows to add character strings to a note file that is saved at
the end of each script. Usage should follow the first example:
take_note("Note created:", timestamp(quiet = TRUE))
. Note that this modifies
notes
in place, so the result should not be assigned.
Then there is the 0_run_all.R
file, which runs all analysis scripts in order
and documents when this last happened.