I am using r and RStudio at work, I do not have full admin privileges for my machine, but I can manually move (copy paste) files from one folder to another. I can download a package .zip, but the install process in R and via RStudio wants to automatically move the unpacked file from one system folder to another. The problem is that I get the following error/warning :
package ‘vcd’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘C:\Apps\R-3.4.3\R-3.4.3\library\file3f837c424bc_{package_name}’ to ‘C:\Apps\R-3.4.3\R-3.4.3\library_{package_name}’
Is there a way to do the complete install and file moves manually or any other process that will result in a functional package.
This might actually be an issue with your antivirus not having enough time to check the file before it is moved. Try telling R to pause for a minute when installing before moving the file over
run this code:
trace(utils:::unpackPkgZip, edit=TRUE)
Then go down to about line 140, you should see the following:
ret <- unlink(instPath, recursive = TRUE, force = TRUE)
if (ret == 0) {
Sys.sleep(0.5)
change the number in Sys.sleep from 0.5 to 2. For a huge package maybe do 3, but I've found almost everything works if you tell it to wait 2 seconds.
Note, this will reset the next time you restart your R session, so you will need to do it again.
Note - you still have to make sure you have access to write to the file where your packages are kept, but based on your post, it seems that you do. If you find out that you can't write to that directory, you can change where your r packages are kept - but that can be more annoying.
Thank you so much for this, it worked! This saves me all the hassle I was going to have to face against IT to give me special permissions if there was no other way. Thanks again.