Skip to contents

Creates a dockerignore template with patterns to ignore common R-related files and directories.

Usage

dk_template_ignore_r(.dockerignore = NULL, renv = TRUE, packrat = TRUE)

Arguments

.dockerignore

Optional existing dockerignore object to add patterns to

renv

Include renv folders (default: TRUE)

packrat

Include packrat folders (default: TRUE)

Value

A dockerignore object with R-related ignore patterns

Details

This template adds patterns to ignore common R-related files and directories that aren't needed in a Docker image, including:

  • .Rproj.user/: RStudio user settings

  • .Rhistory: R command history

  • .RData: R workspace data

  • .Ruserdata: R user data

  • *.Rproj: RStudio project files

  • *.rds: R serialized data files

  • .Rcheck/: R package check directories

If renv = TRUE, it also adds patterns to ignore {renv} library directories, which should be rebuilt inside the container.

If packrat = TRUE, it adds patterns to ignore {packrat} library directories.

Examples

# Create a new dockerignore with R patterns
di <- dk_template_ignore_r()
di
#> .Rproj.user/
#> .Rhistory
#> .RData
#> .Ruserdata
#> *.Rproj
#> *.rds
#> .lintr
#> *.Rcheck/
#> .Renviron
#> .Rprofile
#> renv/library/
#> renv/staging/
#> renv/python/
#> renv/local/
#> packrat/lib*/
#> packrat/src/ 

# Include R patterns but exclude package managers
di <- dk_template_ignore_r(renv = FALSE, packrat = FALSE)
di
#> .Rproj.user/
#> .Rhistory
#> .RData
#> .Ruserdata
#> *.Rproj
#> *.rds
#> .lintr
#> *.Rcheck/
#> .Renviron
#> .Rprofile