Addin does not appear when installing package with devtools::install but does with install_github

I just started a new package and when i tried to install it at work with devtools::install() the addin is not listed in the "addins list" in Rstudio.

From what i see, it might not only be a problem in my package but is also depend on the installation method i choose:

Reprex: devtools::install_github() works:


Reprex2: devtools::install() does not:

tmp <- tempfile()
download.file(url = "", destfile = tmp)
unzip(tmp, exdir = "code2r")


In the second step, the error:

Error in eapply(pkgload::ns_env(pkg$package), force, all.names = TRUE) :
cannot open file 'C:/Users/User11/Documents/R/win-library/3.6/code2r/R/code2r.rdb': No such file or directory

might appear which goes away after restarting RStudio.

Expected output:



I posted the question first here: and as suggested
by Jim Hester i moved it to here. If there are problems with reproducibility or if i oversaw something obvious, just let me know.

I would like to have devtools::install() working as well, as install_github() is not whitelisted in some corporate settings.

1 Like

I was able to replicate this behavior with the code2r package:

  • When installed with devtools::install_github(), the RStudio Addin is instantly added in the Addins menu. The package namespace does not even need to be loaded for this change to take effect (confirmed via isNamespaceLoaded("code2r"))

  • When installed with devtools::install(), the Addin is not instantly available in the Addins menu. Even attaching the package does not add it. The RStudio Session has to be restarted (Ctrl-Shift-F10) for the Addin to be included in the menu.

Furthermore, I tried devtools::install_local(), since I expected this to behave more like install_github(). However, it too required that the R session be restarted before the RStudio Addin was available.

Thus in the short-term, I'd recommend restarting the session after installing your package (and documenting in the installation instructions that this will be necessary if the user performs a local installation).

In the long-term, if you really wanted to know what was causing the difference, my suspicion is that RStudio is performing some magic behind the scenes. It uses hooks to have more control over various installation functions, so I suspect that install_github() intersects one of these special functions.

> install.packages
function (...) 
.rs.callAs(name, hook, original, ...)
<environment: 0x555d1ce0cb38>
> remove.packages
function (...) 
.rs.callAs(name, hook, original, ...)
<environment: 0x555d1ce11558>

That being said, I tried running debugonce(install.packages) prior to running the installation commands, and wasn't entered into the debugger, so it's totally possible my theory is totally off.

I obtained the above results using the Docker image rocker/tidyverse, running Debian 10, R 3.6.3, RStudio Server 1.2.5042, devtools 2.3.0, and remotes 2.1.1.