search for: rmpkg

Displaying 2 results from an estimated 2 matches for "rmpkg".

Did you mean: mpkg
2024 Apr 11
1
[External] Re: Repeated library() of one package with different include.only= entries
...rations, today I think we'd want to do... modify_attach = function(pkg, new_names) { if (!startsWith(pkg, "package:")) pkg <- paste0("package:", pkg) old <- tryCatch(ls(pkg, all.names=TRUE), error=\(c) character()) if (length(old)) detach(pkg) attachNamespace(.rmpkg(pkg), include.only=c(new_names, old)) } Perhaps detach() could invisibly return the exported names to make this a tiny bit easier (today it returns NULL): modify_attach = function(pkg, new_names) { if (!startsWith(pkg, "package:")) pkg <- paste0("package:", pkg) old &lt...
2024 Apr 15
1
[External] Re: Repeated library() of one package with different include.only= entries
...> modify_attach <- function(pkg, new_names) { > if (!startsWith(pkg, "package:")) pkg <- paste0("package:", pkg) > old <- tryCatch(ls(pkg, all.names=TRUE), error=\(c) character()) > if (length(old)) detach(pkg) > attachNamespace(.rmpkg(pkg), include.only=c(new_names, old)) > } > Perhaps detach() could invisibly return the exported names to make this a > tiny bit easier (today it returns NULL): I agree that such changed detach() behavior would be "nice" here; but I wouldn't like to change its d...