BR-Visualization / brcharts

Create BR charts
https://br-visualization.github.io/brcharts/
MIT License
0 stars 0 forks source link

Workflow to execute data-raw #33

Open Lovemore-Gakava opened 4 months ago

Lovemore-Gakava commented 4 months ago

Investigate to check if there is workflow to check if data is in sync with the data-raw code.

Lovemore-Gakava commented 3 months ago

To create a Git workflow for an R package that executes data-raw and regenerates data when a commit is done, you can follow these steps:

  1. Initial Setup:

    • Initialize a new Git repository for your R package.
    • Create a .gitignore file to exclude generated data and any other unnecessary files from version control.
  2. Package Structure:

    • Ensure your R package follows the standard structure with R/, data-raw/, and inst/ directories among others.
    • Place your original data sources or scripts to generate data in the data-raw/ directory.
  3. Set Up Scripts:

    • Create a script (e.g., 01_prepare_data.R) inside the data-raw/ directory to generate or prepare the data for your package.
    • Ensure that the script saves the generated data to the appropriate location within the package (e.g., inst/extdata/ or data/).
  4. Git Hooks:

    • Utilize a Git hook, specifically a post-commit hook, to execute your data generation script (01_prepare_data.R) after each commit. This will ensure that the data gets regenerated automatically after a commit is made.
  5. Automation:

    • Consider automating the process using a task runner like make or a continuous integration (CI) tool like GitHub Actions or Travis CI. This will further streamline the process and ensure that the data regeneration happens consistently.
  6. Version Control:

    • Ensure that your version control system (Git) is appropriately set up to track changes to the data generation script and the generated data itself.

By following these steps, you can create a Git workflow for your R package that not only includes version control but also automatically executes the data generation process when a commit is made. This can help maintain the consistency and reliability of the data used within your R package.