
Tool: Check if a package is installed
Source:R/tool-session-package-installed.R
btw_tool_session_check_package_installed.Rd
Checks if a package is installed in the current session. If the package is installed, it returns the version number. If not, it suggests packages with similar names to help the LLM resolve typos.
Value
A message indicating whether the package is installed and its version, or an error indicating that the package is not installed.
Examples
btw_tool_session_check_package_installed("dplyr")@value
#> [1] "Package `dplyr` version 1.1.4 is installed."
tryCatch(
btw_tool_session_check_package_installed("dplry"),
error = function(err) {
cat(conditionMessage(err))
}
)
#> Package dplry is not installed.
#> ℹ Did you mean "dplyr", "rpart", "R6", "bslib", or "callr"?