Error message from install.packages() - wayward continuation line - r

With RStudio and running under Windows, my effort to install the textreg package encountered a strange error:
> install.packages("textreg")
Warning in install.packages :
downloaded length 17116 != reported length 200
Warning in install.packages :
downloaded length 17116 != reported length 200
Error in install.packages : Found continuation line starting ' <title>Marriott – ...' at begin of record.
Does the error tell me that something in the package has the gremlin ....? Can I fix that problem at my end or should I write Luke Miratrix, the maintainer? Or am I doing something foolish?
Thank you

The windows binary is currently not available from CRAN and that install.packages didn't report that indicates that the mirror is not up-to-date. However, I was able to build the package from source on my Win7 system. Thus, you can use install.packages("textreg", type="source").

The windows binary is currently not available from CRAN because the package failed the windows test suite (for reasons as yet unknown). I am working on fixing that error and apologize for any inconvenience. That being said, installing as mentioned above via
install.packages("textreg", type="source")
will give you a working package. If you get it to crash, please contact me (the maintainer) with details.
Also note that a further mild issue is the static vignette "bathtub" does not show up on CRAN, but is in the inst/doc directory of the package. You can also test the package with the testthat package using the inst/test/testthat folder in the package.

Related

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.

Unable to install quantreg package and update R version

I am using R version 3.3.1 on RStudio interface, and a Windows 10 OS. I was trying to install the 'quantreg' package for quantile regression, however I was getting the error message
Warning in install.packages :
InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
downloaded length 180224 != reported length 1521162
Warning in install.packages :
package ‘quantreg’ is not available (for R version 3.3.1)
I repeated the process afterwards several times but got the last line of the above error all the time. Thinking it was due to using an older R version, I tried updating by installing the 'installr' package, but that too gave me the same error as above. I tried updating R from the Tools Menu, but it kept telling me that the current R version is the latest.
Also this is my first time here, so apologies if I've messed up the blockquoting.
You need to downgrade R.
Download an older version here (I recommend 3.2.5) and install.
Then (in R), go to Tools > Global Options > press the "Change" button.
Now simply select the version you want and restart R and try reinstalling the package.

MacOS Rstudio devtools loading fails

I need to install the package devtools in R on my mac. The R version is 3.2.3.
It gives an error saying
Warning in install.packages :
download had nonzero exit status
Warning in install.packages :
download of package ‘curl’ failed
Other posts addressing similar issues provide solutions to Linux (with the apt-get command, etc) but doesn't seem to have a Mac solution. Highly appreciate if someone with insight can offer some guide here.
The problem pertains to the download, have a look at this discussion. You can consider downloading the package first and installing a package from a local zip file.
install.packages("local_package_file", repos = NULL)
or more specifically:
install.packages("devtools.zip", repos = NULL, type = "source")
as shown on the devtools # GitHub.
You didn't mentioned, but I understand that you have the Xcode installed as well. Alternatively, it could be informative to check if your R compiler has no problems with connecting to the Internet, you can use the code: is.character(getURL("www.google.com")).

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.

Did the subdirectory structure of package repositories change as of R 2.15.2?

Kind of embarrassing / a no-go, but since it hasn't been that long that I've moved from "pure user" to "beginner-developer", I've never actually read the CHANGELOG when a new R version came out - well until today (and I have the feeling I should make this a habbit) ;-)
Yet I'm not sure if the supposed change actually occurred since I couldn't find anything about it at a first glimpse at the CHANGELOG of R R 2.15.2:
Actual question
Is it possible that the (subdirectory) structure of package repositories changed from
./bin/windows/contrib/2.xx/
to
./src/contrib/2.xx/ or even ./src/contrib?
Or at least that the PACKAGES file now needs to live here: ./src/contrib/PACKAGES?
Background info
Up to version 2.15.1, the following path worked to install packages from my local package repository:
path.repos <- "L:/R/packages"
repos <- file.path("file://", path.repos)
Function contrib.url would take repos and expand it to the right subdirectory:
> contrib.url(repos)
[1] "file:///L:/R/packages/bin/windows/contrib/2.15"
But when I try to run install.packages(), I get the following error for R 2.15.2:
> install.packages("mypkg",
+ lib=file.path(R.home(), "library"),
+ repos=repos,
+ type="win.binary"
+ )
Error in read.dcf(file = tmpf) : cannot open the connection
In addition: Warning message:
In read.dcf(file = tmpf) :
cannot open compressed file 'L:/R/packages/src/contrib/PACKAGES', probable reason 'No such file or directory'
>
When I do the same with R 2.15.1, everything works smoothly.
Due dilligence
There are some references with respect to repositories in the CHANGELOG, but the only section I found that gives me some evidence that the supposed change occurred is this:
PACKAGE INSTALLATION
For a Windows or Mac OS X binary package install, install.packages() will check if a source package is available on the same repositories, and report if it is a later version or there is a source package but no binary package available.
Just had a look at the official documentation again and got the idea that maybe arg type is not passed along to contrib.url() correctly as it seems to me install.package() is looking at the place for type="source" packages?
This particular bug isn't the same as mine.
This issue relates to checks install.packages() now runs before installing. As Rappster said, it tries to find a source package to compare the binary version with:
For a Windows or Mac OS X binary package install, install.packages() will check if a source package is available on the same repositories, and report if it is a later version or there is a source package but no binary package available.
So a simple way of squashing this message is creating the R/src/contrib directory and running tools::write_PACKAGES() in that directory to create (an empty) PACKAGES file.
And of course, the reason you aren't getting this message in 2.15.1 is that it doesn't do the checking (see R NEWS quote above) that 2.15.2 performs.
I have submitted a bug report of my issues. No news yet. May post it to the R mailing list as well.

Resources