setup_project: Setup folders and .gitignore for projects and repos

View source: R/setup.R

setup_projectR Documentation

Setup folders and .gitignore for projects and repos

Description

This function:

  • creates standard folders for analytical projects

  • exempts /outputs/., and data & temp files from syncing with git

  • adds a markdown readme

  • asks if you want to use {renv}

  • asks if you want to use {targets}

Usage

setup_project(default_branch = NULL, type = "full")

Arguments

default_branch

(str, default = NULL) the default branch of the repo, one of 'main' or 'master'. If NULL it will try to figure it out.

type

What kind of configuration to create?

  • tidyverse creates a minimal lintr config, based on the default linters (linters_with_defaults()). These are suitable for following the tidyverse style guide.

  • full creates a lintr config using all available linters via all_linters().

Details

The folders created are:

  • code for your scripts

  • data for small, local data

  • outputs for your outputs, not synced with git

  • R for you custom functions

Temporary files exempted from syncing are:

  • History files

    • .Rhistory

    • .Rapp.history

  • Session Data files

    • .RData

  • User-specific files

    • .Ruserdata

  • Example code in package build process

    • -Ex.R

    • Output files from R CMD build

      • /

      .tar.gz

  • Output files from R CMD check

    • /.Rcheck/

    • RStudio files

      • .Rproj.user/

    • Produced vignettes

      • vignettes/

      .html

    • vignettes/*.pdf

  • OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3

    • .httr-oauth

  • Knitr and R markdown default cache directories

    • *_cache/

    • /cache/

  • Temporary files created by R markdown

    • *.utf8.md

    • .knit.md

    • R Environment Variables

      • .Renviron

    • pkgdown site

      • docs/

    • Output folder

      • outputs/

    • Translation temp files

      • po/

      ~

  • Leaflet file folders

    • *_files/

  • Office and web documents

    • *.docx

    • *.html

    • *.pdf

    • *.csv

    • *.xls

    • *.xlsx

    • *.ppt

    • *.pptx

Examples

## Not run: 
sak::setup_project(default_branch = "main") # This will make all your folders

## End(Not run)

baslat/sak documentation built on April 14, 2025, 4:14 p.m.