Skip to contents

usethis style functions

These functions typically exist to make package development simpler by fixing common errors in bulk. They assume the project is managed in a git repository and make changes that may need manual reversion

bump_dev_version()
Update the version of a package, incrementing dev versions.
fix_check()
Fix common check errors
fix_dependencies()
Fixes dependencies in the namespace file using the output of R CMD check.
fix_global_variables()
Adds global variables identified at R CMD check`` to a globals.R` file
fix_non_standard_files()
Adds non standard and hidden files to the .Rbuildignore file
fix_unqualified_fns()
Fix unqualified functions in active source pane
fix_unqualified_fns_bulk()
Fix unqualified namespaced functions.
fix_utf8_encoding()
Fixes utf8 encoded characters in source files replaincg them with \uXXXX
migrate_to_pins()
Migrate package data to a github hosted pin board
qcheck()
Check the package structure without running any code
undo()
Undo a bulk pkgtools operation

Support for analysis projects

usethis focusses on package projects, but similar functions are useful in analysis projects which may be maintained using renv rather than description files.

document()
Document package and non-package projects
install_local()
Install package locally using renv if available.
set_renv_repos()
Adds new repositories to the beginning of an renv lockfile
unstable()
Reload a set of packages that are in development on the local machine

Standalone files

Standalones make a lot of sense for utility functions that are reused in many places but not exposed to the user. This set of tools help you setup and maintain them.

sync_standalone_to_master()
Synchronise master version of standalone file with editor contents
update_standalone()
Update or create a standalone metadata block in the Rstudio editor.
use_standalone()
Extended version of use_standalone that works with analysis projects

Editing utilities

Some additional tools to help general editing tasks.

find_and_replace()
Regex find and replace on a codebase
merge_code()
Merge Code Versions using Shiny and CodeMirror 5 MergeView
run_commented_code()
Execute commented out code
standalone_snapshot()
Generate a hash based expectation for a standalone object
switch_expect_equals()
Switch expression for equality based test case.
switch_standalone_snapshot()
Switch global variable for hash based test case.
what_has_changed()
Compare content of editor with last saved version

Roxygen tags

Custom roxygen tags for adding unit tests and documenting formal paramters

roxy_tag_parse(<roxy_tag_dparam>)
Parser for @dparam tags
roxy_tag_parse(<roxy_tag_unit>)
Parser for @unit tags
roxy_tag_rd(<roxy_tag_dparam>)
Support for @dparam tags
roxy_tag_rd(<roxy_tag_unit>)
Support for @unit tags

Others

style_text()
Style code in pkgtools style