Check for missing packages in library()
, require()
, loadNamespace()
, and requireNamespace()
calls.
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.