create_dirs: Create directories

View source: R/create_dirs.R

create_dirsR Documentation

Create directories

Description

The main purpose of create_dirs() is to create default directories used in data science projects. create_dirs() can also create custom directories.

Usage

create_dirs(dirs = NULL)

Arguments

dirs

a character vector with the directory names. Default is NULL and create ⁠data/{raw,clean,temp}⁠, ⁠output/{figures,results,supp}⁠, and R

Goal

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

Acknowledgment

create_dirs() takes advantage of the functions available in the excellent {fs} package.

Examples

## Not run: 
# create a single directory
create_dirs("myfolder")
# create the default directories
create_dirs()
# see the resulting tree
fs::dir_tree()

## End(Not run)

kguidonimartins/misc documentation built on Dec. 20, 2024, 7:03 p.m.