You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are an increasing number of places where we want to run R code in another session with the package installed. But installing is a relatively expensive operation, so it would be nice if we could minimise the times we do it. I suggest a with_temp_install() that does something like this:
with_temp_install<-function(code, pkg=".") {
dev_lib<- file.path(tempdir(), "dev-library")
if (!file.exists(dev_lib)) {
dir.create(dev_lib)
}
if (needs_install(pkg)) {
install(pkg=pkg, quick=TRUE, reload=FALSE, dependencies=FALSE)
}
withr::with_temp_libpaths(code)
}
hash<- new.env(parent= emptyenv())
needs_install<-function(pkg=".") {
# Hash R/*.R and src/*.{c,cpp} and NAMESPACE, ...# Compare hashes
}
(With accompanying local version too)
The text was updated successfully, but these errors were encountered:
There are an increasing number of places where we want to run R code in another session with the package installed. But installing is a relatively expensive operation, so it would be nice if we could minimise the times we do it. I suggest a
with_temp_install()
that does something like this:(With accompanying local version too)
The text was updated successfully, but these errors were encountered: