3

I'm trying to install Rstudio addins, but they don't show up in the Addins button or Tools → Addins → Browse Addins... menu. I first updated my Rstudio, and then reinstalled again, to no avail.

This is how I proceed:

devtools::install_github("rstudio/addinexamples", type = "source")

It installs successfully (and I can check that it appears correctly in the package tab or in C:\Users\USERNAME\Documents\R\win-library\4.0\addinexamples) but still does not show up under the addins button. Username has special characters though (French accents). Would that be the problem?

enter image description here

Even after loading the library manually as so:

library(addinexamples)

The library appears loaded but no button. I tried many other packages with the same result (e.g., addinmanager, addinslist, colourpicker, esquisse). I also tried installing packages from CRAN directly with the same results. E.g.,

install.packages("datapasta")
package ‘datapasta’ successfully unpacked and MD5 sums checked

enter image description here

Any idea? Thanks.

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] lattice_0.20-41  codetools_0.2-16 mvtnorm_1.1-1    zoo_1.8-8        psych_2.0.7      MASS_7.3-53     
 [7] grid_4.0.3       nlme_3.1-149     xtable_1.8-4     coda_0.19-4      estimability_1.3 multcomp_1.4-13 
[13] bootES_1.2       Matrix_1.2-18    boot_1.3-25      sandwich_2.5-1   splines_4.0.3    TH.data_1.0-10  
[19] tools_4.0.3      emmeans_1.5.1    parallel_4.0.3   survival_3.2-7   compiler_4.0.3   mnormt_2.0.1   

Reposted from: https://community.rstudio.com/t/no-addins-found/92070

rempsyc
  • 785
  • 5
  • 24
  • 1
    Hi, I know its not a proper comment for SO, however I am so amused that you again ran into the exactly same problem as I did (with the `devtools::github_install`). Did you manage to find any solution in the mean time? – Björn Aug 19 '21 at 10:17
  • Sorry for my late answer, somehow I had missed your comment. I did actually fix the issue, though I am not exactly sure how. I think I updated Rstudio and R to the latest versions, and now the problem is gone. I will add an answer too for other people coming to this post. – rempsyc Aug 22 '21 at 21:13
  • 1
    @Björn please let me know if this works for you. Otherwise, I think the only other thing I might have changed following our `github_install()` issue is to install all my packages outside of my accented username file path to one of the simplest file path, i.e., `C:\Rpackages`. – rempsyc Aug 22 '21 at 21:58
  • 1
    Thats what did the trick, change the `.libPaths()` – Björn Aug 23 '21 at 11:00

2 Answers2

2

Edit: Seems like what might have actually fixed the issue in my case is to relocate my library path to a location with no accents, e.g., C:/Rpackages. So I first created a new folder C:/Rpackages and then copied all my current non-base packages there.

I then used the following instructions to change my default file path:

Installations of R will tend to install libraries at C:/Program Files/R/R-X.X.X/library, which may not always be writable. The only way to effectively change this default resides outside of R in Microsoft Windows.

In the Microsoft Control Panel, go to System and Security > System > Advanced system settings > Environment variables.

A new environment variable should be created by clicking on “New…” and entering R_LIBS_USER as the variable name and [your new path, e.g., C:/Rpackages] as the variable path (change as appropriate).

Save the changes and restart R.

enter image description here

Then check that the library is set correctly correctly:

> .libPaths()
[1] "C:/Rpackages"                      "C:/Program Files/R/R-4.0.5/library"

Note: the default library will always be the one on the left, so it's displaying correctly right now. However, the one on the right cannot be changed and will display the R version you're using for base and default packages. That's OK and the issue is still fixed.

Thanks @Bjnör for help identifying the issue.


Old answer:

The issue is now fixed on my end, though I am not exactly sure how. I did update Rstudio and R to the latest versions, and now the problem is gone, so it is likely that this is what solved it in my case given I don't think I have changed anything else.

  • Rstudio Version 1.4.1717
  • R version 4.0.5 (2021-03-31)

enter image description here

rempsyc
  • 785
  • 5
  • 24
  • 1
    I guess its rather the change in `.libPaths()` to no special characters used. I am Running the newest R Version `R = 4.1.1` & `RStudio Version 1.4.1717`, so it should be update on my end. I am gonna try to place in a smiliar simple folder. Did you change anything else? If the change in directory fixes it for me it might be worth updating your answer with pointing this out – Björn Aug 23 '21 at 06:17
  • 1
    Could you add the following steps to the answer? 1.) check were your packages are located `.libPaths()`. 2.) Create a new directory with no special character (e.g., ö in my case or accents é in yours). One possible directory would be in the root of C: `C:/Rpackages` 3.) [For Savety] Create a backup of your old libsPath: `saveRDS(.libPaths(), "BackupOldPackageDir.rds")` 4.) Change the .libPaths to the new directory. `.libPaths(c("C:/Rpackages","C:/Program Files/R/R-4.1.1/library" ))`. I can confirm that this fixed the issue for me – Björn Aug 23 '21 at 06:28
  • Hello @Björn I have edited my answer with the actual steps I took to change my file path. I'm not sure but I think I remember reading somewhere that using the `.libPaths()` method is not permanent and you will need to do it every time you restart R. Perhaps try my new suggested method and let me know if it works? Thanks. – rempsyc Aug 23 '21 at 19:47
  • 1
    Hey oh sorry that was unfortunate, just responded to your previous comment to write an answer. And yeah you are right, I just validated that after restart of Rstudio one would have to set the `.libPaths()` manually again, or else it will be resettet to default. I think your answer is thus more correct. Another way to prevent this would be by changing the .Rprofile – Björn Aug 23 '21 at 19:52
  • 1
    No worry at all, I wanted to give you the answer at first but then I deleted that comment because I realized that you didn't actually used the same steps as I did (read too quickly lol) so edited my answer instead since I wasn't sure if you had all the steps I had used. Still upvoted your answer though. – rempsyc Aug 23 '21 at 19:55
1

Ok I think I now what solved the issue. You can not have any special character in your .libPaths(). In my case it was the ö. Once I changed the .libPaths() to a special character free directory addins did appear in RStudio (see the Screenshot below)

Step-By-Step Guide:

  1. Check if your standard serach paths for R (.libPaths()) contains special characters (e.g., ö, é or others). In my case it did:

    .libPaths()
    [1] "C:/Users/Björn/Documents/R/win-library/4.1" "C:/Program Files/R/R-4.1.1/library" 
    
  2. Create a safety backup of your current .libpaths():

    # Creates an .rds file in the current working directory
    saveRDS(.libPaths(),"BackupR-PackageSearchPaths.rds")
    
  3. Create a new directory without any special characters, where you want to store R-Packages in the future. You could for example use: C:/Rpackages

  4. If you want to make your life easier go to the old directory of R-packages (in my case: C:/Users/Björn/Documents/R/win-library/4.1 and copy all packages to the new directory C:/Rpackages

  5. Add the new directory to the .libPaths().
    Please note: Don't get confused with the windows default backslash (\) in paths. Just use the forward slash like C:/Rpackages or make sure to escape the backslash with a double backslash \\

    .libPaths(c("C:/Rpackages","C:/Program Files/R/R-4.1.1/library" ))
    
  6. On restart of Rstudio however the .libPaths() resets to the default. To change this behavior you want to add the new directory to the environment (path) variables on your local machine, as pointed out by RemPsyc. Just press win + r to open the run command and enter the following text

    rundll32.exe sysdm.cpl,EditEnvironmentVariables

    enter image description here

  7. This will open the environment variable editing window: there you can click on "new" and add the following - see also this answer

    Variable name: R_LIBS_USER
    Variable value: C:/software/Rpackages

Result:

This solve the issue for me
enter image description here

Setup
R = 4.1.1
RStudio Version 1.4.1717

Björn
  • 1,610
  • 2
  • 17
  • 37
  • 1
    Does it still work if you restart R/Rstudio? Have a look at this answer from another thread about `libPaths()`: https://stackoverflow.com/a/19662905/9370662 – rempsyc Aug 23 '21 at 19:54
  • 1
    Yes thank you that did the trick. Also added a shortcut to open the environment variable editing window – Björn Aug 23 '21 at 20:06