
A hack is to load rsconnect to memory and and modify the sub-sub-sub-function performPackratSnapshot() to allow this. This is an option in packrat, but rsconnect does not expose this option.
#Packrat definition generator
(4) During deployment, manifest generator (packrat) will ignore the existence of any named local_package. shinyconnect/packrat_sees_these_dependencies.R #these codelines will be recognized by packrat and package will be added to manifest The script will never be actually be executed. Make script loading all the dependencies of your local package. Library(local_package) #now local_package must load If(file.exists("./local_package/DESCRIPTION")) load_all("./local_package/") #for shiny conenct where local_package is inside shinyapp If(file.exists("./DESCRIPTION")) load_all(".") #for local test on PC/Mac, where the shinyapp is inside the local_package #if local_package here, just build on 2 sec with devtools::load_all() #load already built local_package or for shiny connection pseudo-build on-the-fly and load Library(htmltools) #or what ever you need Hack rsconnet/packrat to ignore specifically named packages when building shinyconnect/packrat_sees_these_dependencies.R to shiny folder, this will be picked up by packrat-manifest inst/shinyconnect/local_packageĪdd script. inst/shinyconnect/ or what ever and local package would be copied to. Write a script that copies all your source files, such that you get a shinyapp with a source directory for a local package inside, you could call the directory for. The solution goes like:Īdd to global.R if(!require(local_package) ) devtools::load_all("./local_package") I suppose thise would also work with shinyapps.io, but I have not tried. I found a nice alternative/Hack to Rstudio official recommendations. Overall I think RS connect is great product because it is simple, but when it comes to local packages it is really not.
#Packrat definition install
It is also inconvenient that I have to email IT-support to make them manually install new packages. In many cases, I can't just set up local repositories in the organization because, I do not have clearance for that. Personally I dislike all options for including local/private packages, as it defeats the purpose of having a nice easy target for deploying shiny apps. One should always check what options RStudio connect supports at the moment: Any guidance on configuring my repo so packrat can understand it would be great. I think this last part is showing I'm materially misunderstanding something. At no point would a repo have the structure it's looking for? I would have thought this is guaranteed to fail, because repos follow the C://bin/windows/contrib/3.3/ structure. If I drill into packrat:::findLocalRepoForPkg, it fails because it can't find a file/folder called: "C://". If I follow through the functions, I can see the particular point of failure is packrat:::findLocalRepoForPkg(" No package ' 'found in local repositories specified However when I try to deploy a Shiny app or Rmd which references, I get the following error on my deploy: Error in findLocalRepoForPkg(pkg, repos, fatal = fatal) : This indicates to me that the local repo is set up correctly.Īs an additional aside, I have changed the DESCRIPTION file to have an extra line saying repository:LocalCurrent. Options(repos = c(options("repos")$repos,LocalCurrent = paste0("file:",RepoAddress)))Ĭurrently this works nicely and I can install my custom package from the local repo. # Add this new repo to Rs knowledge of repos. I understand the only way I can get our custom packages to work within apps with RSConnect is to get up a local repo and set our options(repos) to include this.Ĭurrently I have the following: library(drat)ĭrat::insertPackage(, repodir = RepoAddress) For our work, we have made custom packages, which we have updated amongst ourselves by opening the project and build+reloading. We have recently got RStudio Connect in my office.