packageEnv
is a slight modification from topenv
, which
returns the top environment, which in the case of development
packages is the environment into which the source files are loaded by
load_all
.
packageEnv(pkg, skip = FALSE, verbose = FALSE)topns_name(n = 1L, strict = TRUE, unique = TRUE)
topns(strict = TRUE)
packageName(envir = packageEnv(), .Global = FALSE, rm.prefix = TRUE)
str_ns(envir = packageEnv())
packagePath(..., package = NULL, lib.loc = NULL, check = TRUE)
isPackageInstalled(..., lib.loc = NULL)
as_package(x, ..., quiet = FALSE, extract = FALSE)
packageEnv
returns an environment
topns_name
returns the name of the namespace a character string.
topns
returns an environment.
packageName
returns a character string
packagePath
returns a character string.
as_package
returns a package
object like devtools::as.package.
package name. If missing the environment of the runtime caller package is returned.
a logical that indicates if the calling namespace should be skipped.
logical that toggles verbosity
number of namespaces to return
a logicical that indicates if the global environment should be considered as a valid namespace.
logical that indicates if the result should be reduced to contain only one occurence of each namespace.
environment where to start looking for a package name. The default is to use the runtime calling package environment.
a logical that indicates if calls from the global
environment should throw an error (FALSE
: default) or the string
'R_GlobalEnv'
.
logical that indicates if an eventual prefix 'package:' should be removed from the returned string.
arguments passed to file.path
.
optional name of an installed package
path to a library of R packages where to search the package
logical that indicates if an error should be thrown if the path to the
package root directory cannot be found.
If this is the case and check = FALSE
, then the function returns NULL
.
package specified by its installation/development path or its name
as 'package:*'
.
a logical that indicate if an error should be thrown if a
package is not found. It is also passed to find.package
.
logical that indicates if DESCRIPTION of package source files should be extracted. In this case there will be no valid path.
topns_name()
: returns the name of the runtime sequence of top namespace(s),
i.e. the name of the top calling package(s), from top to bottom.
The top namespace is is not necessarily the namespace where topns_name
is effectively called.
This is useful for packages that define functions that need to access the
calling namespace, even from calls nested into calls to another function from
the same package -- in which case topenv
would not give the desired
environment.
topns()
: returns the runtime top namespace, i.e. the namespace of
the top calling package, possibly skipping the namespace where topns
is effectively called.
This is useful for packages that define functions that need to access the
calling namespace, even from calls nested into calls to another function from
the same package -- in which case topenv
would not give the desired
environment.
packageName()
: returns the current package's name.
It was made internal from version 0.16, since the package utils
exported its own packageName
function in R-3.0.0.
str_ns()
: formats a package environment/namespace for log/info messages.
packagePath()
: returns the current package's root directory, which is
its installation/loading directory in the case of an installed package, or
its source directory served by devtools.
isPackageInstalled()
: checks if a package is installed.
isPackageInstalled
returns a logical flag.
as_package()
: an enhanced version of as.package
,
that is not exported not to mask the original function.
It could eventually be incorporated into devtools
itself.
Extra arguments in ...
are passed to find.package
.