Install scale in R - r

I try to install scale in R by:
devtools::install_github("scale",username="hadley/scale")
But
Downloading github repo hadley/scale/scale#master
Error in download(dest, src, auth) : client error: (404) Not Found
In addition: Warning message:
Username parameter is deprecated. Please use hadley/scale/scale

The general syntax of install_github function is:
install_github(repo)
where repo is in the format username/repository
The syntax of both username and repository should be checked, to avoid the message
Error in download(dest, src, auth) : client error: (404) Not Found
It is also a good practice to compare versions available on both GitHub and CRAN. In the case of identical versions available, the simplest would be:
install.packages(pkg, dependencies = TRUE)
where dependencies argument ensures the installation of all packages which pkg depends on/links to/imports/suggests.

Related

Problems installing older version of Bioconductor's mixOmics packages in R

I've spent the day trying to load the appropriate package versions in R that I saved in a renv lockfile.
I used the package RVAideMemoire which is tied in with mixOmics in bioconductor, which can't be loaded automatically using renv::restore().
I followed the steps outlined here to install the appropriate version of bioconductor (3.11) to get moxOmics version 6.12.1.
R how to install a specified version of a bioconductor package?
Unfortunately I ended up with mixOmics version 6.14.1.
I attempted to load the earlier version using:
BiocManager::install("mixOmics", version = '6.12.1')
which resulted in the following error:
Error: version '6.12.1' must have two components, e.g., '3.7'
This seemed somewhat unclear, and I thought the additional ".1" at the end might be causing problems, but what I tried loading the version omitting the last ".1" as shown:
BiocManager::install("mixOmics", version = "6.12")
I got another error:
Error: unknown Bioconductor version '6.12'; see https://bioconductor.org/install
I'm at a bit of a loss here. The renv::restore() function won't complete the update as long as the mixOmics package install keeps failing, so I seem to be a bit stuck until I can get this straightened out.
EDIT
Just to provide some more info for the renv error, here's the message I get:
Error: failed to retrieve package 'mixOmics'
In addition: Warning messages:
1: In system2("curl", args$data(), stdout = TRUE, stderr = TRUE) :
running command '"curl" --config "C:/Users/Corey/AppData/Local/Temp/RtmpuYYvKB/renv-tempdir-3d7050aa2ac3/renv-download-config-3d7076f57e1c"' had status 22
2: In downloader(url, destfile, type, request, headers) :
curl: (22) The requested URL returned error: 404
3: In system2("curl", args$data(), stdout = TRUE, stderr = TRUE) :
running command '"curl" --config "C:/Users/Corey/AppData/Local/Temp/RtmpuYYvKB/renv-tempdir-3d7050aa2ac3/renv-download-config-3d701ff05e24"' had status 22
4: In downloader(url, destfile, type, request, headers) :
curl: (22) The requested URL returned error: 404`
After trying initial suggestion of using
options(renv.settings.bioconductor.version = "3.11") renv::install("bioc::mixOmics#6.12.1")
I got the following errors:
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details
replacement repositories: CRAN: https://cran.rstudio.com
Querying repositories for available binary packages ... Done!
Querying repositories for available source packages ... Done!
Retrieving 'https://bioconductor.org/packages/3.12/bioc/src/contrib/Archive/mixOmics/mixOmics_6.12.1.tar.gz' ...
Retrieving 'https://bioconductor.org/packages/3.12/data/annotation/src/contrib/Archive/mixOmics/mixOmics_6.12.1.tar.gz' ...
Retrieving 'https://bioconductor.org/packages/3.12/data/experiment/src/contrib/Archive/mixOmics/mixOmics_6.12.1.tar.gz' ...
Retrieving 'https://bioconductor.org/packages/3.12/workflows/src/contrib/Archive/mixOmics/mixOmics_6.12.1.tar.gz' ...
Retrieving 'https://bioconductor.org/packages/3.12/books/src/contrib/Archive/mixOmics/mixOmics_6.12.1.tar.gz' ...
Retrieving 'https://cran.rstudio.com/src/contrib/Archive/mixOmics/mixOmics_6.12.1.tar.gz' ...
Error: failed to retrieve package 'mixOmics'
In addition: There were 24 warnings (use warnings() to see them)
BiocManager::install() doesn't provide an interface for installing specific versions of a package. The documentation for the version argument states:
version: 'character(1)' Bioconductor version to install, e.g.,
'version = "3.8"'. The special symbol 'version = "devel"'
installs the current 'development' version.
That is, it relates to the Bioconductor version, not the package version.
That said, you should be able to use renv to install a specific version of the package from Bioconductor. For example:
options(renv.settings.bioconductor.version = "3.11")
renv::install("bioc::mixOmics#6.12.1")
You could also use renv::settings$bioconductor.version("3.11") to store the required version of Bioconductor as a project setting, to be used by renv during restore().
I used the package RVAideMemoire which is tied in with mixOmics in bioconductor, which can't be loaded automatically using renv::restore().
I'd be curious to know why renv::restore() is failing for you.
EDIT: Based on your output, you're trying to use Bioconductor 3.12, but mixOmics 6.12.1 isn't available from that version of Bioconductor. You need to set the Bioconductor version used by renv as detailed in this answer. (You might also need to install the latest version of renv to gain support for this.)

Error message in installing github projects

I am trying to install the ggmap latest version package from github using
devtools::install_git("dkahle/ggmap") and it shows me this error. Can anyone help me out?
Thank you
Downloading git repo dkahle/ggmap
Error in git2r::clone(x$url, bundle, credentials = x$credentials, progress = FALSE) :
Error in 'git2r_clone': unsupported URL protocol
In addition: Warning message:
In git2r::remote_ls(remote$url, credentials = remote$credentials) :
Error in 'git2r_remote_ls': unsupported URL protocol

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.

How to use install_github

I am trying to calculate weight of evidence and information value, and found online that R package riv and tomasgreif does the job. Both packages are located on github, so I used the following code:
library(devtools)
install_github("riv","tomasgreif")
library(woe)
But it gives me the following error/warning message:
> install_github("riv","tomasgreif")
Installing github repo riv/master from tomasgreif
Downloading master.zip from https://github.com/tomasgreif/riv/archive/master.zip
Error in function (type, msg, asError = TRUE) : couldn't connect to host
In addition: Warning message:
In mapCurlOptNames(names(.els), asNames = TRUE) :
Unrecognized CURL options: writedata
How can I solve this problem?
I tried to download the file manually. R returned no error, but the package is not found in the list... (I am able to install some other packages saved in the same location with similar code)
> install.packages("~/riv.zip", repos = NULL)
> library("riv")
Error in library("riv") : there is no package called ‘riv’
I was able to resolve it via downloading Open Source R from Revolution Analytics, then manually downloaded woe package from git and pasting that directly into library folder of OpenSource R
and loaded it library(woe) it will work
Also based on the same lines will be releasing IV and WOE for python also

error with R CMD check because of package dependency

Background
I am creating a newpackage that depends on oldpackage, and have indicated this dependency in the file newpackage/DESCRIPTION.
Furthermore,
oldpackage is installed in the directory, ~/lib/R
my .Rprofile includes .libPaths("~/lib/R")
hence, I can successfully load oldpackage without specifying the library location, e.g., using the command library(oldpackage) in R
Despite the ability to load the package without having its library specified, R CMD check newpackage gives an error indicating that it can not fine oldpackage:
checking whether the package can be loaded ... ERROR
Loading required package: oldpackage
Error: package 'oldpackage' 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 'oldpackage'
Execution halted
It looks like this package has a loading problem: see the messages for
details.
Questions:
Why is R unable to find the package?
Can I specify the library location in the DESCRIPTION file?
Regarding question 1), it is both a FAQ and yet somewhat annoying. R CMD check runs in vanilla mode, so it will not find user-level libraries. As I recall, setting R_LIBS="...." in the call helps, so try that.
Regarding question 2), no you cannot give a location in DESCRIPTION. Which makes sense as that file needs to work 'everywhere' whereas your location info is local to your machine.

Resources