cannot install R package - r

I hit this error when I try to install rJava package in R. Please help
> utils:::menuInstallPkgs()
trying URL 'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/3.1/rJava_0.9-6.zip'
Content type 'text/html; charset=UTF-8' length 3280 bytes
opened URL
downloaded 3280 bytes
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open compressed file 'rJava/DESCRIPTION', probable reason 'No such file or directory'

Related

packages installation issues with R 4.1.0

Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : cannot open the connection
In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : cannot open compressed file 'shiny/DESCRIPTION', probable reason 'No such file or directory'
Here are the error messages that I am receiving from R 4.1.0 when installing some packages (tidyverse, shiny). I am using R console with windows system. Thank you

Installing package from a local zip file in R [duplicate]

This question already has an answer here:
Install package without internet: error in install.packages: no such file or directory
(1 answer)
Closed 6 years ago.
I am trying to install a package in R from a local zip file. I have the zip file on a local drive, but when I go to Packages --> Install a package from a local zip file I get the following warning:
> utils:::menuInstallLocal()
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : cannot open compressed file 'cirt/DESCRIPTION', probable reason 'No such file or directory'
What is going on here?
Many thanks in advance,
A
Try :
install.packages(file.choose(), repos = NULL, type="source")
It will allow you to select the desired zip file.

sentiment package installation from local zip file issue

I am trying to find a way to install sentiment package in R for performing sentiment analysis.
I searched in all d repositories but it isn't available.I am trying to manually install sentiment_0.2.tar file from local directory but i get this:
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open compressed file 'sentiment_0.2.tar.gz/DESCRIPTION', probable reason 'No such file or directory'
How do i resolve this problem? any valuable suggestions will be of great help.
Please try:
install.packages(file.choose(), repos = NULL, type="source")
This should allow you to select the file itself and install the package subsequently. Also, please note that the package version may not be compatible with the current R version on your machine.
Thanks!

Warning while installing package in R

I have been trying to install the ggplot2 package in R and this is the warning I have been getting:
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In download.file(url, destfile, method, mode = "wb", ...) :
downloaded length 1040720 != reported length 1152839
2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
3: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open compressed file 'plyr/DESCRIPTION', probable reason 'No such file or directory'
It might be helpful to note that I am using the version 3.1.1. Could you please help me understand what went wrong and how I could resolve this?
Thank you in advance.
From the comments we discovered that somehow your repos option had been set to a bad value.
install.packages has an argument called repos that can be used to specify where to find the package that you'd like to install. If you specify a valid value, it should just work. e.g. you shouldn't get the error if you do this: install.packages("ggplot2", repos="http://cran.us.r-project.org")
If you do not provide a value, it will look at the repos option. See getOption("repos") to see what is set. In your case it was
CRAN CRANextra
"freestatistics.org/cran" "stats.ox.ac.uk/pub/RWin"
neither of which are valid URLs.
You can change the value of the repos option like this
options(repos=c(CRAN="#CRAN#",
CRANextra="http://www.stats.ox.ac.uk/pub/RWin"))

Unable to install lavaan package

I was trying to install the lavaan package but I encounter the following error message. Do you have any idea how I can resolve this issue?
Thanks,
Joseph
install.packages("lavaan")
Installing package into ‘C:/Users/abc/Documents/R/win-library/3.0’ (as ‘lib’ is unspecified)
trying URL 'http://cran.cnr.Berkeley.edu/bin/windows/contrib/3.0/lavaan_0.5-14.zip'
Content type 'application/zip' length 572076 bytes (558 Kb)
opened URL
downloaded 284 Kb
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In download.file(url, destfile, method, mode = "wb", ...) :
downloaded length 290913 != reported length 572076
2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
3: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open compressed file 'lavaan/DESCRIPTION', probable reason 'No such file or directory'

Resources