Otago Study Group SYSKA

The OtagoStudyGroup Stuff You Should Know About blog

usethis - project setup

One of the packages that was a highlight for me from rstudio::conf2018 was usethis.

This package forms part of the package building workflow but also general project workflows.

In a package development workflow some of the key functions are:

# creates a new dir and populates with a skeleton containing examples
usethis::create_package("/path/to/create/package")

# creates an R script in the R/ dir (don't need to include the .R extension)
usethis::use_r("filename")

# series of license templates such as mit, gpl3, cc0 etc
usethis::use_*_license_license("name")

# initialises a testthat dir to put tests
usethis::use_testthat()

# creates a testfile
usethis::use_test("filename")

# creates a README file for your package
usethis::use_readme_md()

Share