Skip to content

Initialize Report Project

The initialize_report_project() function in the reportifyr package creates a directory structure for report generation and ensures all necessary subdirectories are present. If required, it also initializes a Python virtual environment using reportifyr’s initialize_python() function.


initialize_report_project()

R: Create report directories within a project
initialize_report_projectR Documentation

Description

Create report directories within a project

Usage

initialize_report_project(project_dir)

Arguments

project_dir

The file path to the main project directory where the directory structure will be created. The directory must already exist; otherwise, an error will be thrown.

Examples

## Not run: 
initialize_report_project(project_dir = tempdir())

## End(Not run)

Returns

If the following directory structure does not exist within the provided project_dir, it will be created:

  1. report
    • draft: Contains drafts of reports.
    • final: Contains final versions of reports.
    • scripts: Contains report scripts.
    • shell: Contains report shells.
  2. OUTPUTS
    • figures: Stores generated figures.
    • tables: Stores generated tables.
    • listings: Stores generated listings.
  3. .venv

If a standard_footnotes.yaml is not found within the report subdirectory, a prompt stating:

> Copied standard_footnotes.yaml into /cluster-data/user-homes/user/project/report

If a .venv is not found in the project_dir, it initializes one using initialize_python() and returns a prompt.


Logging

  • Debug: Logs the start and end of the function, as well as the creation of certain subdirectories (e.g, draft, figures, tables, etc.).
  • Info: Logs when the project_dir is validated, when report and OUTPUTS subdirectories are created, and when the standard_footnotes.yaml file is copied over.
  • Error: Logs and stops execution if the project_dir does not exist.

Additional Resources

  • reportifyr GitHub: Refer to the reportifyr repository for more details.
  • Initialize Python Reference: Refer to the reference on initialize_python() here.