This function extracts all package names that
are needed to run the code returned by the agent
and installs them as needed.
Arguments
- code
code block returned by the agent.
Value
final status of the packages as a logical vector, TRUE if packages is already installed
or could be installed. FALSE if the package can't be install.
Examples
# \donttest{
# Check code for packages that need installing
code <- "library(devtools)\n x<-5"
extractInstallPkg(code)
#> Loading required package: devtools
#> Loading required package: usethis
#> devtools
#> TRUE
# }