Unable to install any packages on R - r

I am trying to install packages for a spatial data course however each package I try install to R I get this same error message
Warning in install.packages :
'lib = "C:/Users/chris/OneDrive/Documents/R/win-library/3.4"' is not writable
I have made a folder under R in documents for 3.4.
I also get this error message;
cannot create dir 'C:\Users\chris\OneDrive\Documents\R\win-library\3.4\file2d1c49893057', reason 'No such file or directory'
Error in install.packages : unable to create temporary directory ‘C:\Users\chris\OneDrive\Documents\R\win-library\3.4\file2d1c49893057’
I don't understand whether I have to create a new directory before I install an R package or if I have a setting that prevents it from being able to install packages?
I have installed packages before/had R for 2 years and never had this issue....

Related

Problems with installing any packages in Rstudio

I have a problem installing any packages in Rstudio, here are some screenshots of code and results(mistakes)
then it's written that it's not writable
then there is a question: do you want to create your own library ? yes
and then i get this error:
cannot create dir 'C:\Users\darya\OneDrive\?????????', reason 'Invalid argument'
Error in install.packages : unable to create ‘C:/Users/darya/OneDrive/?????????/R/win-library/4.1’
How can I fix it ?

Can`t install datasets in R, not cvs and not xlsx

I am new to RStudio. And it was working well, about a week ago my computer update the new version of the system. And from this moment R doesnt work like before. I am trying to load at datasets in .xlsx and .cvs - it doesn`t work. R write like this:
** Installing R Package Dependencies for Excel Import: `'readxl', 'Rcpp'`
[1/5] Installing cellranger...
�������������� � utils::install.packages("cellranger", repos = "https://cran.rstudio.com/") :
'lib = "C:/Program Files/R/R-4.0.2/library"' is not writable
������ � utils::install.packages("cellranger", repos = "https://cran.rstudio.com/") :
unable to install packages
������: sourceWithProgress -> eval -> eval -> <Anonymous>
���������� �����������
I trying to install xlsx packages, it writes like this:
`install.packages("xlsx")`
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Warning in install.packages :
'lib = "C:/Program Files/R/R-4.0.2/library"' is not writable
Warning in install.packages :
не могу создать каталог 'C:\Users\Lina\OneDrive\?????????' по причине 'Invalid argument'
Error in install.packages : unable to create ‘C:/Users/Lina/OneDrive/?????????/R/win-library/4.0’
if somebody can help me?
Since you appear to be a Windows user, I can offer two pieces of advice.
First, make sure your R installation is in a location that you have write permissions to. In some Windows OS, the Program Files locations are by default locked down. If the computer is yours, you should be able to change the permissions to the R folder. How to do so will vary a little by your windows version, so I will not provide more instructions. One other thing you can try is to set R and RStudio to "Run as administrator".
Second, OneDrive is a bad place to put your R installation or your R packages. OneDrive does not support all filenames and file extensions. R and its packages will generate a number of unsupported files, and you will continually be notified that something will not sync and that you should do something about it.
On a Windows machine, I generally install R and set up the library at C:\R where I have appropriate permissions.

cannot install R package using install_local on linux server

I have been trying to install "ncdf4" package in R locally for more than two days now. First I tried installing "ncdf4" package with package.install() but it did not work. Afterwards, I downloaded binary file of the package and tried installing it using install_local:
> library("devtools")
> install_local("/path to the package/",quiet=FALSE)
However, this generated following error:
Installation failed: cannot open the connection
Warning message:
In read.dcf(path) :
cannot open compressed file
'/<path_to_the package>/DESCRIPTION', probable reason 'Not a directory'
I also could not install some other packages using install_local(). Can anyone help me out in troubleshooting this error?

Error installing packages in Rstudio

I have R 3.2.2 setup installed in my system,with RStudio version 0.99.489. When I tried to install rJava package,
install.packages("rJava")
I am getting following Error:
Warning in install.packages :
downloaded length 4878 != reported length 200
Error in install.packages : subscript out of bounds
But if I run the below command before installing any package,it works fine, but I don't want to do this every time I install a package.
options(repos=structure(c(CRAN="http://cran.us.r-project.org")))
You can stick the line you want executed at every startup in your .Rprofile file which should be in your home directory. I have 3.2.3 version of R and that worked; however I do get a warning message about using a non-http version of the site.
Similarly to you, I was finding the original repository the system was using was failing to install the packages--not finding the package or downloading a file with too few bytes, perhaps because of a transient problem. You might want to consider not putting this in your .Rprofile file or commenting the line outin case this is a temporary workaround.

Installing the package ZIGP from R archive

I'm unable to install the ZIGP package in R (version 2.14.1). I've downloaded the file ZIGP_3.8.tar.gz from http://cran.r-project.org/src/contrib/Archive/ZIGP/ to the directory
"C:\Program Files\R\R-2.14.1\library". I've already tried several ways to install this package, but without success! For instance, I entered into the R program as an administrator (item "Run as administrator") and I've tried the command
install.packages("ZIGP", pkgs="C:/Program Files/R/R-2.14.1/library/ZIGP_3.8.tar.gz",repos=NULL), and the error message was:
Warning in install.packages("ZIGP", pkgs = "C:/Program Files/R/R-2.14.1/library/ZIGP_3.8.tar.gz", :
'lib = "ZIGP"' is not writable
Error in install.packages("ZIGP", pkgs = "C:/Program Files/R/R-2.14.1/library/ZIGP_3.8.tar.gz", :
unable to install packages
I've changed the security status in R properties, but the error remains the same.
Do anyone have any idea to solve this problem?
Thanks very much in advance.

Resources