Skip to contents
#>  Setting active project to "/tmp/RtmpJJLCD7".
#>  Creating R/.
#>  Writing DESCRIPTION.
#> Package: RtmpJJLCD7
#> Title: What the Package Does (One Line, Title Case)
#> Version: 0.0.0.9000
#> Authors@R (parsed):
#>     * First Last <first.last@example.com> [aut, cre]
#> Description: What the package does (one paragraph).
#> License: `use_mit_license()`, `use_gpl3_license()` or friends to
#>     pick a license
#> Config/roxygen2/version: 8.1.0
#> Encoding: UTF-8
#> Roxygen: list(markdown = TRUE)
#>  Writing NAMESPACE.
#>  Setting active project to "<no active project>".

Create package infrastructure

A spinner startup message

use_zzz() creates a package documentation file with .onLoad, .onAttach, and %||%. It is similar to usethis::use_package_doc() while also providing a useful starting template.

use_zzz(path = dir, open = FALSE)
#>  Setting active project to "/tmp/RtmpJJLCD7".
#>  Created /tmp/RtmpJJLCD7/R/RtmpJJLCD7-package.R from template.
#>  Adding cli to Imports field in DESCRIPTION.
#> 
#>  Refer to functions with `cli::fun()`.

Check missing function in _pkgdown reference

check_pkgdown_reference() identifies exported functions that are absent from the reference section of _pkgdown.yml.

Vendor permissively licensed code

use_vendor() records attribution and licensing information when incorporating selected source files from a permissively licensed GitHub R package. It creates an inst/vendor/ directory, a R/vendor-*.R file, and updates relevant DESCRIPTION fields.

try(use_vendor(
  pkg = "WangLabCSU/rpkgkit",
  "43_use_vendor.R",
  branch = "main",
  path = dir
))
#>  Fetching repository information for WangLabCSU/rpkgkit...
#>  Vendor package uses MIT license.
#>  Created directory /tmp/RtmpJJLCD7/inst/vendor/rpkgkit.
#>  Copied LICENSE.
#>  Copied LICENSE.md.
#>  Created inst/vendor/rpkgkit/README.md.
#>  Created /tmp/RtmpJJLCD7/R/vendor-rpkgkit.R.
#>  Added rpkgkit authors to Authors@R.
#>  Updated DESCRIPTION.
#>  Consider pasting the following statement into README.md
#> 
#> 
#> ## Acknowledgements
#> 
#> We would like to thank the following people and projects:
#> 
#> - The authors of the [rpkgkit](https://github.com/WangLabCSU/rpkgkit) package &mdash; **Yuxi Yang** &mdash; whose code is included (under MIT license) in `R/vendor-rpkgkit.R`.

Only packages with a supported permissive license can be vendored. Review the acknowledgement text printed by the function and add it to your README when appropriate.

rpkgkit::PERMISSIVE_LICENSE
#> [1] "MIT"          "Apache-2.0"   "Apache 2.0"   "BSD-2-Clause" "BSD-3-Clause"
#> [6] "Unlicense"    "CC0-1.0"      "CC0"

usethis extensions

Use the following helpers from the package root:

Use R 4.1.0 version

R 4.1.0 introduced the pipe (|>) and anonymous function \(). If these syntaxes need to be used in a package, the R package must require at least R version 4.1.0.

use_r_v4.1.0(path = dir)
#>  Adding R to Depends field in DESCRIPTION.

Add URL in DESCRIPTION

use_url(dir)

Add bug reports URL in DESCRIPTION

Open CFF

CITATION.cff files are plain text files with human- and machine-readable citation information for software and datasets.

Code developers can include such files in their source code repositories to let others know how to correctly cite their software.

This cannot replace usethis::use_citation(), it just complements project.

Global ignore-file templates

Use add_global_rbuildignore() and add_global_gitgnore() to add the corresponding global ignore-file templates to a package.

add_global_rbuildignore(path = dir)
#>  Added 39 pattern(s) to .Rbuildignore.