-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Description
lintr::lint(
text = '"pkg" %in% installed.packages()',
linters = lintr::all_linters()
)
#> ℹ No lints found.Created on 2025-09-16 with reprex v2.1.1
installed.packages() can be pretty slow, as noted in the documentation:
This needs to read several files per installed package, which will be slow on Windows and on some network-mounted file systems.
It will be slow when thousands of packages are installed, so do not use it to find out if a named package is installed (use find.package or system.file) nor to find out if a package is usable (call requireNamespace or require and check the return value) nor to find details of a small number of packages (use packageDescription).
And the recommended way to test for package availability should be requireNamespace("pkg", quietly = TRUE).
TimTaylor
Metadata
Metadata
Assignees
Labels
No labels