Displaying 3 results from an estimated 3 matches for "previously_attached".
2025 May 23
1
FR: improve "use" function
...e(package))
return (invisible(FALSE))
}
if (missing(include.only)) {
ns <- asNamespace(package, base.OK = FALSE)
include.only <- getNamespaceExports(ns)
}
if (package %in% .packages()) {
name <- paste0("package:", package)
previously_attached <- ls(name, all.names = TRUE)
if (!all(include.only %in% previously_attached)) {
detach(name, character.only = TRUE)
include.only <- union(include.only, previously_attached)
attachNamespace(package, include.only = include.only)
} # else no n...
2025 May 23
1
FR: improve "use" function
Hello,
Currently `use` fails silently if you try to attach functions from the
same namespace. It would be nice and more similiar to the use of
roxygen2 if it could add (and maybe even remove?) functions. Here is a
simple proof of concept I have posted on Stack Overflow [1]. Something
similar could be done within `use`. Of course, it would be preferable if
it didn't need to detach the
2025 May 27
1
FR: improve "use" function
...LSE))
> }
> if (missing(include.only)) {
> ns <- asNamespace(package, base.OK = FALSE)
> include.only <- getNamespaceExports(ns)
> }
> if (package %in% .packages()) {
> name <- paste0("package:", package)
> previously_attached <- ls(name, all.names = TRUE)
> if (!all(include.only %in% previously_attached)) {
> detach(name, character.only = TRUE)
> include.only <- union(include.only, previously_attached)
> attachNamespace(package, include.only = include.only)
&...