prInit {tinyProject} | R Documentation |
Initialise a project
Description
prInit
should be used in a Rstudio project. The function creates
the basic structure of a data analysis project that will help you keep your
your work organised and increase your productivity.
Usage
prInit(dir = ".", instructions = TRUE)
Arguments
dir |
Directory where project files will be stored. By default, it is the current working directory. |
instructions |
Should instructions added in the scripts created by the the function? |
Details
The function creates three folders :
scripts: Folder where the scripts are stored
data: Folder where the source and intermediate data files are stored
output: Folder where the output of the project are stored
These three folders are essential so do not remove them. But you can add any other folders you desire ("latex", "presentation", etc.)
Additionally, three scripts are created:
main.R: This is the main script of your project. Ideally, just by looking at this script you should remember how your project is organised For small projects most code can go in this script. But for larger project, it should mostly contain comments what each script is supposed to do. You can use the function
prScript
to programatically open the scripts you are referring to.data.R: This script should contain inscruction to import data in the project and/or transform the source data in processed data that will be studied/analysed. As for the script "main", for large project, this script should not contain code, but make reference to the scripts that do the job.
start.R: script that is executed every time the project is opened. It should load the packages used in the project, define constant values, ... More generally it should include all technical instructions that do not directly participate to the creation, manipulation or analysis of data.
See Also
prLibrary
, prSource
, prSave
,
prLoad
, prScript
Examples
projectPath <- file.path(tempdir(), "test")
prInit(projectPath)
list.files(tempdir(), recursive = TRUE, include.dirs = TRUE)