Skip to contents

Copies a package template into a new directory. The template includes a DESCRIPTION file, a minimal R/ directory and placeholders with instructions. You can then edit these files to customize your new package.

Usage

pkg_template(path = NULL, pkgname = NULL)

Arguments

path

Path to the new project

pkgname

Name of the new package

Value

The file path to the copied template (invisibly).

Examples

# create a new directory
dir <- paste0(tempdir(), "/", gsub("\\s+|[[:punct:]]", "", Sys.time()))
dir.create(dir)

# copy the package template into the directory
pkg_template(dir, "mynewpkg")
#> Creating /tmp/RtmpFuWuYm/20261201002702219819/tests
#> Creating /tmp/RtmpFuWuYm/20261201002702219819/tests/tinytest.R
#> Creating /tmp/RtmpFuWuYm/20261201002702219819/inst
#> Creating /tmp/RtmpFuWuYm/20261201002702219819/inst/tinytest
#> Creating /tmp/RtmpFuWuYm/20261201002702219819/inst/tinytest/test_mynewpkg.R