Why cant I install mediate package with R 3.6.1? - r

I wanted to add the package "mediation". R Studio therefore asked for the latest Rtools update, which I installed successfully. When I know try to run the install.packages("mediation"), this happens:
package ‘checkmate’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\Carolin\Documents\R\win-library\3.6’ for modifying
Try removing ‘C:\Users\Carolin\Documents\R\win-library\3.6/00LOCK’
I already searched this problem intensively on the internet, but the following suggested solutions didnt work for me:
install.packages("mediation", INSTALL_opts = c('--no-lock'))
as well as
unlink("C:/Users/Carolin/Documents/R/win-library/3.6/00LOCK")
I would be happy if somebody could help me with it.

Try to delete the aforementioned ‘C:\Users\Carolin\Documents\R\win-library\3.6/00LOCK’ by directly accessing the folder and manually deleting the file (If it actually is a file, which I do not know). [Let's hope it is not an essential file for R to work]

Related

How to Install mlr3extralearners in R?

So I am going to do some survivalsvm process and I need the mlr3extralearners package from GitHub. When I tried to install it locally using the tar.gz file, it said
Execution halted
Warning in install.packages: installation of package had non-zero exit status
I also tried to use the zip file, and it said
install.packages("C:/Users/Ivan/Downloads/mlr3extralearners-0.5.49.zip", repos = NULL, type = "win.binary", lib="C:/R-4.2.1/library")
then nothing happened.
I also tried using devtools::install_github("mlr-org/mlr3extralearners"), but the output was the same when I used the tar.gz file. When I checked in my library, I already have the mlr3extralearners package, but when I call it using library(mlr3extralearners), it does not work. Does anyone know how to solve this? Any help is appreciated.
https://rdrr.io/github/mlr-org/mlr3extralearners/
I believe this should work for you:
Install the latest version of this package by entering the following in R:
install.packages("remotes")
remotes::install_github("mlr-org/mlr3extralearners")

In installing / updating r packages I am getting namespace error, Permission Denied error etc

I am new in R and my tidymodels have been giving me issues lately so from one of stckoverflow post I got to know about updating "tune" packages from github but this was giving issues so I reinstalled rtools.
I have reinstalled rtools, have set path variables.
Issues
Now whenever I try devtools::install_github("tidymodels/tune") I get error Error: package ‘digest’ does not have a namespace.
I have tried reinstalling rlang and there I get Permission denied: problem copying C:\R\R-4.0.3\library\00LOCK\rlang\libs\x64\rlang.dll to C:\R\R-4.0.3\library\rlang\libs\x64\rlang.dll: Permission denied
As in another post I read about reinstalling glue I get Permission denied for same as well: problem copying C:\R\R-4.0.3\library\00LOCK\glue\libs\x64\glue.dll to C:\R\R-4.0.3\library\glue\libs\x64\glue.dll: Permission denied Warning in install.packages : restored ‘glue’
Is this normal with R or do I need to fix something and how do I fix it? Appreciate any suggestions or help !!
try to delete and reinstall "glue", then update devtools and install tune.
you can face issues if you don't have write access to C: and try installing packages there. Try running R or Rstudio in admin-mode. If you can't, add a second library to .libPaths using some folder where you have write-accesss.
Your point 4 seems to be linked to my point 2 here.

Why do I get a "failed to lock directory" error when installing packages on my work laptop

I've recently installed R + Rstudio on my work-laptop and now I'm trying to install packages. I have full authorisation in the map that I'm downloading the packages to. However, I keep on getting the following error:
Error in install.packages : ERROR: failed to lock directory
‘\\hltfs001\Home$\jolien.jansen\Documents\R\win-library\3.6’ for
modifying. Try removing
‘\\hltfs001\Home$\jolien.jansen\Documents\R\win-library\3.6/00LOCK’
This error is accompanied by this error:
Warning in install.packages :
'lib = "\\hltfs001/Home$/jolien.jansen/Documents/R/win-library/3.6"'
is not writable
I've tried to install the packages in a different folder, which I'm also authorised to do, but that did not solve the issue.
I've googled the error and that gave me a couple of things to try.
At first I tried manually removing the LOCK folder, and restarting R. That did not help
Then I tried this code:
unlink("/hltfs001/Home$/jolien.jansen/Documents/R/win-
library/3.6/00LOCK", recursive = TRUE)
Which again removed the LOCK folder, but didn't help with the error either
Finally I tried:
install.packages("Rcpp", dependencies=TRUE, INSTALL_opts = c('--no-
lock'))
But again, that gave me the same error.
I had the same problem and I found that my problem is that my 00LOCK folder was located within an automatic-syncing Dropbox folder. So, I paused the Dropbox sync and then the problem went away after I deleted the 00LOCK folder. Apparently, the Dropbox syncing was interfering with the file locking mechanism of the installation process. So, once I finished installing the packages, I resumed my Dropbox syncing.

problems with installing r packages on windows 10

I'm having problems installing r packages using R3.4.1 on windows 10.
E.g. I get the following message when trying to install a package:
package ‘ctv’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘C:\Program Files\R\R-3.4.1\library\file34470c9f23\ctv’ to ‘C:\Program Files\R\R-3.4.1\library\ctv’
I would really appreciate any assistance to resolve this issue.
Normally one puts the library in C:\user\yourname\Documents\R\win-library. Each version of R will have its library in a separate folder within that folder. In that case you won't get this error. If you reinstall R and accept the default for the library location then it will put the library there and you won't get this error.
If you prefer the configuration you have now because, for example, there are multiple users on your PC that need to share the library, then you will need to be Administrator each time you install a package; however, note that your current configuration is less secure than the default.

Issue installing a package in R

I'm new to R. Trying to install the package UsingR but running into problems:
library(UsingR,lib="C:\[whereitwent]")
Loading required package: HistData
Error: package ‘HistData’ could not be loaded
In addition: Warning message: In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) : there is no package called ‘HistData’
Now when I did the install.packages("UsingR", lib="C:\[whereitwent]") bit, there was a weird part:
Warning: unable to move temporary installation ‘C:[where it went]\library\file7946ce71334\acepack’ to ‘C:\[whereitwent]\R-Portable\App\R-Portable\library\acepack’ package ‘HistData’ successfully unpacked and MD5 sums checked
I was having this same problem yesterday except instead of "there is no package called 'HistData' it was telling me there is no package called 'Formula'. I uninstalled and reinstalled R Portable this morning, tried again, and this is the result. My professor did this exact thing on her computer right in front of me yesterday and everything worked fine. I've tried this on two computers myself and it's the same issue both places. I've tried googling this but can't find anything substantive, and frankly I'm not really even sure how to google this exact issue. Can anyone help me identify the problem?
Note: "[whereitwent]" is my edit here so I'm not showing off my whole thing including my name. Everything else is copied and pasted exactly as is.
If you just want to be able to install packages, this will set library path:
.libPaths('C:/[path]')
you might need to escape the slashes, I'm sorry I don't use windows. You can add this to a file .Rprofile in your home folder and you won't have to do it again.
Alternatively (or in concert) you may want to look at the packrat package which will install packages with the project you're working on
This error is related to permissions issues, run R or RStudio as administrator (assuming you're on windows) and re-install the package.
If you are unable to run as administrator you usually will not be able to write to the C:\Program Files directory on a corporate computer. All you need to do is change the directory to which the package is installing to a folder to which you have read write permissions. For example, on my computer:
install.packages("gdata", lib = "C:/Users/mkemp6/Desktop/Rscrap", repos = "http://dirichlet.mat.puc.cl/")
To view permissions on a specific folder, right click the folder, select the "Security" tab and and highlight your username.
The same problem was solved by updating R to 3.1.3
I was experiencing similar issue on my Ubuntu machine. I solved it by running R as a "sudo" user and then install the packages from CRAN.

Resources