cannot install R package using install_local on linux server - r

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?

Related

Unable to install any packages on 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....

Installing packages to R from desktop

I am trying to install several packages to R. The packages were send to me via email from my biostatistician and I have them on my desktop in a file called R_scripts.
I have tried:
install.packages("/Users/isimee/Desktop/R_scripts/findalpha.R", repos=NULL, type="source")
Which returns following error message:
Error in untar2(tarfile, files, list, exdir, restore_times) :
incomplete block on file
Warning message:
In install.packages("/Users/isimee/Desktop/R_scripts/findalpha.R", :
installation of package '/Users/isimee/Desktop/R_scripts/findalpha.R' had non-zero exit status
findalpha.R is one of the packages I am trying to install.
I am using terminal on a mac but have tried from R directly and it doesnt work. I have downloaded the devtools but doesnt work either apart from that I dont really know what to do with it.
Help would be very much appreciated. Thanks a lot.

Sentiment Analysis using R: github 'okugami79/sentiment140' package installation error

I wish to install sentiment140 github package by developer okugami79. I wrote following script for the same:
install.packages("githubinstall")
require(devtools)
library(githubinstall)
install_github('sentiment140', 'okugami79')
library(sentiment)
But it threw an error:
Installation failed: Failed to connect to raw.githubusercontent.com port 443: Timed out
Warning message: Username parameter is deprecated. Please use okugami79/sentiment140
Then I modified installation statement as follows:
install_github('okugami79/sentiment140')
Still it threw an error:
Installation failed: Failed to connect to raw.githubusercontent.com port 443: Timed out
I checked for solution on stackoverflow through following link:
Timeout R package installation from Github
Here, I found a way to install github package by downloading package zip file and installing it in R using:
install.packages("/address/to/zip-package", repos = NULL, type="source")
This also prompts error:
Warning: invalid package 'sentiment-master'
Error: ERROR: no packages specified
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\u257449\Documents\R\win-library\3.3" "sentiment-master"' had status 1
Warning in install.packages : installation of package ‘sentiment-master’ had non-zero exit status
How should I go about installing required package from github in R ? Your valuable advice/solution is requested.
Thank You !
Just a straightforward pair of functions installed this package from Github source for me on both Windows and OSX.
install.packages("devtools")
devtools::install_github('okugami79/sentiment140')
There may be something unusual about your system setup, in which case, it would be helpful to have your session information. You can get that by entering sessionInfo().
However, note that this package you are looking to install is over 4 years old per the description file on Github. A lot of work has gone into other packages that work with natural language processing and sentiment analysis. The CRAN Task View for Natural Language Processing is a good place to start for an overview of many of these packages that can be installed directly from CRAN. There are many resources that are better maintained. For example, here's a chapter on sentiment analysis using the tidytext package.

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.

ggplot2 version 1.0.1 won't load into R 3.2.2 for Windows

I just started using R and downloaded ggplot2
install.packages("ggplot2")
I get the following warning:
Warning in install.packages:
unable to move temporary installation '\\CHI-FIlE-01\UserFolders$\naresh.kavuri\Documents\R\win-library\3.2\file27ac2d3b613c\ggplot' to '\\CHI-FILE-01\UserFolders$\naresh.kavuri\Documents\R\win-library\3.2\ggplot2'
This warning is followed up with this error:
Error: invalid version specification 'NA'
In addition: warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
As anyone come across this problem before? Did I do something wrong in the setup?
If you have multiple versions of R running, and you try to update or reinstall a package in one version of R while it is loaded in another, then the old version of the package doesn't get completely removed.
Try closing down all instances of R, manually deleting the folder containing the package, then opening a single version of R and reinstalling.
As Pascal commented, antivirus file scans can also interfere with the installation process. Sometimes downloading the package zip/tar.gz file then installing from disk can circumvent the issue.

Resources