I can't install packages using install_github() in R

Whenever I try to install a package using devtools:install_github() in RStudio, I always get the following error

Error: ERROR: no permission to install to directory.....

Example: I tried installing abbrevTexts package from github because it isn't on CRAN

devtools::install_github(repo = 'GitHub - edvardoss/abbrevTexts: Functions that will make life less sad when working with abbreviated text for multiclassification tasks')

install_github(repo = 'https://github.com/edvardoss/abbrevTexts')
Downloading GitHub repo edvardoss/abbrevTexts@HEAD

v  checking for file
'C:\Users\Admin\AppData\Local\Temp\RtmpaYzhG4\remotes13087fd31b53\edvardoss-abbrevTexts-e1ced05/DESCRIPTION' (1.4s)
-  preparing 'abbrevTexts': (458ms)
v  checking DESCRIPTION meta-information
-  checking for LF line-endings in source and make files and shell scripts (534ms)
-  checking for empty or unneeded directories
     NB: this package now depends on R (>= 3.5.0)
     WARNING: Added dependency on R >= 3.5.0 because serialized objects in
     serialize/load version 3 cannot be read in older versions of R.
     File(s) containing such objects:
       'abbrevTexts/data/rawProducts.RData'
       'abbrevTexts/data/standardProducts.RData'
-  building 'abbrevTexts_0.1.0.tar.gz'
   
Installing package into ‘C:/Users/Admin/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
Error: ERROR: no permission to install to directory 'C:/Users/Admin/Documents/R/win-library/4.1'
Warning message:
In i.p(...) :
  installation of package ‘C:/Users/Admin/AppData/Local/Temp/RtmpaYzhG4/file13082b9f66da/abbrevTexts_0.1.0.tar.gz’ had non-zero exit status

I have tried updating permissions on every R folders but to no avail. I can install packages from CRAN using install.packages() easily and without problems

My .libPaths() shows 2 directories.

[1] "C:/Users/Admin/Documents/R/win-library/4.1"
[2] "C:/Program Files/R/R-4.1.0/library"

The first directory contains my packages. Please I need to know if this is an R problem or Windows permission issue and how best to fix it. This issue is really affecting my productivity. Help is really needed.

  1. R version 4.1.0
  2. RStudio version 2022.02.3 Build 492
  3. HP Windows 10

You are trying to install a package to "C:/Users/Admin/Documents/R/win-library/4.1", where you don't have a permission to write. It seems you don't have admin rights. I'm surprised you can install with install.packages().

Either you change access rights to this directory, login as Admin, or specify and alternative location for your library:

.libPaths("/path/to/your/personal/library")

or use a lib option

install_github(repo = 'https://github.com/edvardoss/abbrevTexts', lib = "/path/to/your/personal/library")

I basically reset my laptop (which in turn reset Windows permissions) and the problem was solved. I can now install packages using install_github() and install _packages().
What a relief.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.