The main purpose of create_dirs()
is to create default directories used
in data science projects. create_dirs()
can also create custom
directories.
create_dirs(dirs = NULL)
a character vector with the directory names. Default is NULL and
create data/{raw,clean,temp}
, output/{figures,results,supp}
,
and R
There is a somewhat subjective discussion about the ideal directory structure
for data science projects in general (see
here,
here,
here, and
here). In my humble opinion, the
decision should be made by the user/analyst/scientist/team. Here, I
suggest a directory structure that has worked for me. In addition, the
directory structure created fits perfectly with functions present in this
package (for example save_plot
and save_temp_data
).
Below is the suggested directory structure:
.
├── R # local functions
├── data
│ ├── clean # stores clean data
│ ├── raw # stores raw data (read-only)
│ └── temp # stores temporary data
└── output
├── figures # stores figures ready for publication/presentation
├── results # stores text results and others
└── supp # stores supplementary material for publication/presentation
create_dirs()
takes advantage of the functions available in the excellent
{fs}
package.
if (FALSE) {
# create a single directory
create_dirs("myfolder")
# create the default directories
create_dirs()
# see the resulting tree
fs::dir_tree()
}