% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/run_covr_modes.R
\name{load_package_exports_into_env}
\alias{load_package_exports_into_env}
\title{Load exported objects from installed packages into an environment}
\usage{
load_package_exports_into_env(pkg_names, env, overwrite = FALSE)
}
\arguments{
\item{pkg_names}{Character vector of package names whose exported objects
should be copied into `env`.}

\item{env}{Environment into which exported objects should be assigned.}

\item{overwrite}{Logical; if `TRUE`, overwrite objects already present in
`env`. If `FALSE` (default), existing objects are left unchanged.}
}
\value{
A character vector of fully qualified object names that were loaded,
  in the form `"pkg::name"`.
}
\description{
Copy exported objects (typically functions, but also exported constants or
other objects) from one or more installed package namespaces into a target
environment.
}
\details{
This is useful when evaluating code in an isolated environment, such as one
created with `new.env(parent = baseenv())`, where package exports that are
normally available on the search path (for example from `stats` or `utils`)
are not automatically visible.

The function does not attach packages to the search path. Instead, it copies
exported objects directly into `env`.


For each package in `pkg_names`, this function:
\enumerate{
  \item checks whether the package namespace is available,
  \item retrieves the package's exported names,
  \item obtains each exported object with `getExportedValue()`,
  \item assigns the object into `env`.
}

Packages that are not installed or cannot be loaded are skipped with a
message.
}
\keyword{internal}
