Skip to contents

Check for missing packages in library(), require(), loadNamespace(), and requireNamespace() calls.

Usage

missing_package_linter()

See also

linters for a complete list of linters available in lintr.

Examples

# will produce lints
lint(
  text = "library(xyzxyz)",
  linters = missing_package_linter()
)
#> <text>:1:1: warning: [missing_package_linter] Package 'xyzxyz' is not installed.
#> library(xyzxyz)
#> ^~~~~~~~~~~~~~~

# okay
lint(
  text = "library(stats)",
  linters = missing_package_linter()
)
#>  No lints found.