R devtools::install_github() error in download: unauthorized - r

I'm trying to tie R to Twitter and everything I try has been failing. I've been looking at several links including the following: One, Two, Three
While those have led to more issues, I'm now looking at the links here and here to try some workarounds. I would have posted my question as a comment to either of these links but I don't have enough rep yet.
When I run the following code, I get the following error
Code:
library(base64enc)
library(RCurl)
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
devtools::install_github("jrowen/twitteR", user="MY_USERNAME", password="MY_PASSWORD", ref = "oauth_httr_1_0")
Error:
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 3.3 from http://cran.r-project.org/bin/windows/Rtools/ and then run find_rtools().
Downloading GitHub repo jrowen/twitteR#oauth_httr_1_0
Error in download(dest, src, auth) : client error: (401) Unauthorized
Am I just completely missing something here in how to download this dev twitteR package? Does anyone have an idea on how to get past the 401 error?
Thanks,

Have you installed and sourced R tools in the session you are referencing above? You aren't getting a certificate error (were you before?) which suggests you don't have a certificate server you're running under as was the issue in some of your linked posts.
I would suggest the following steps to find your issue.
You may need the httpuv package which can be downloaded sourced with
install.packages('httpuv')
library('httpuv')
Sometimes the twitteR package needs an older version of httr to work correctly, depending on jrowen's (and hadley's) updates.
You may try installing the older version of httr
devtools::install_version("httr", version="0.6.0", repos="http://cran.us.r-project.org")
and restarting R and then trying your install again. Note that if you are on a 64-bit machine, you will probably have to install the most recent version of httr first, then install the older version.

Related

How to install R packages when github is blocked using papaja as an example

I thought I would post this as an answer to anyone having problems installing papaja (or other packages) when behind a firewall that doesn't allow github
The problem
For reasons I dont fully understand, the only way I am able to use github R packages is to download them into my github desktop and then use them using the remotes::install_local("C:\\[path]\\GitHub\\papaja") function. This has worked for all the R packages available from github (CRAN installations are fine).
However this is not the case with papaja which gives me the error:
'Error in curl::curl_fetch_memory(url, handle = h) :
Failed to connect to api.github.com port 443: Connection refused'
I suspect this is because a call is being made to github during the package installation (otherwise why dont I get this issue with all of the other packages I've installed this way).
The attempts
So I went ahead and tried
remotes::install_local("C:\\[path]\\GitHub\\papaja",dependencies=FALSE)
It gave me the error:
ERROR: dependencies 'bookdown', 'rmdfiltr' are not available for package 'papaja'
The answer
So I installed these separately from CRAN and then re ran
remotes::install_local("C:\\[path]\\GitHub\\papaja",dependencies=FALSE)
and the papaja successfully installed. So I guess the installation for the dependencies bookdown and rmdfiltr are making a call to github when they could be installed from CRAN?
So I guess if you get the same error, switch off dependecy installation and install them separately

Quantstrat RStudio R Mac

I am trying to install the package Quantstrat on a Mac.
I searched for help in internet but I did not find a solution.
I already tried:
require(devtools)
install_github("braverock/quantstrat")
The error message I get is:
Downloading GitHub repo braverock/quantstrat#master
from URL https://api.github.com/repos/braverock/quantstrat/zipball/master
Installation failed: Could not find build tools necessary to build quantstrat
I solved the issue.
I just needed to open "Xcode" in the Macbook and accept the new terms and conditions. Then I tried again and I was able to download and install Quantstrat.

devtools::release() Error in 'git2r_remote_fetch': unknown certificate check failure

I am trying to run devtools::release to submit a R package I have written to CRAN and I get the following error message:
devtools::release()
Checking if synched with remote branch...
ERROR: Error in 'git2r_remote_fetch': unknown certificate check failure
I have been able to upload and download my package from GitHub without issues in the past, and the version of the package on my computer is up to date with the version on GitHub. The CMD checks on my computer throw up no issues. Can anyone advise what might be the issue?
This is most likely a security issue (see here; I'm guessing you're using Windows). I had a similar problem, and was being suddenly asked for passwords all the time. I was able to resolve it by downloading and installing the latest version of Git from here.
If you restart your R session, devtools should work properly with Github again.

errors when installing older dplyr package in R

Im a bit new to R and need to use/adapt someone else code in R.
My supervisor uses R version 3.2.2 with the dplyr package version 0.4.3 (to overcome errors and problems with the original code).
I tried to install the older dplyr package with different methods:
- installed devtools package and then used the url devtools::install_url("http://cran.r-project.org/src/contrib/Archive/dplyr/dplyr_0.1.2.tar.gz")
- manual installation (where I downloaded the file and tried to install it.) Installation seemed to have worked but when I run the code it gives a fatal error massage
Every way I've tried so far either gives a lot of error messages or a fatal error and shutdown.
When using help ?dplyr it gives a pop-up that there is an error. Does anybody have any other ideas to install this package?
Thanks!

XML For R Statistics - OSX Version 2.15.1

I have tried to locate the XML package for the above version of R with no success. I have looked on http://www.omegahat.org/ and it goes to a 404 page: http://www.omegahat.org/XML
Basically I am trying to install the RGoogleAnalytics package and that also fails, though i suspect that is because I don't have the XML installed. Does anyone know where I can get the XML package from?
Thanks
Peter
After a bit more searching, I came across this guide, which gives some good hints as to installing RGoogleAnalytics. Here's a slight modification, in case the XML library really can't be found at omegahat:
The last part in step 2 asks you to install the XML library from omegahat. I could successfully install the package from CRAN, however. So simply install.packages("XML") at the R prompt should work.
Next, the guide says that you need to download the RGoogleAnalytics source package directly from Google at the following URL.
Once that was downloaded (and after I installed the RCurl package), I could install RGoogleAnalytics successfully.
For instructions on installing R packages from source, you could see this article on r-bloggers.com or the appropriate section of the R Installation and Admin documentation
EDIT:
The Google Code page for RGoogleAnalytics does suggest using the XML package from omegahat, and it does look like that package is a different version from the one on CRAN. I could successfully install the omegahat version using R 2.15.1 with the following from the R prompt
install.packages("XML",repos="http://www.omegahat.org/R",type="source")
EDIT2: installing RGA from source
If everything is prepared according to the RGA instructions on the Google page, you should be ready to install the RGA package from source with the following line (I had to add --no-multiarch, since XML wasn't installed for 32-bit architecture):
install.packages("~/Downloads/RGoogleAnalytics_1.1.tar.gz",
repos=NULL,type="source",INSTALL_opts="--no-multiarch")
I think you might want:
http://www.omegahat.org/RSXML/
Although it is equally possible that you should be using the XML package from CRAN. I just updated my older version with the current binary install (for R 2.14.2 on MacOS 10.5.8).

Resources