How to resolve SSL error while connecting to REDCap - r

I am running into the following error when making an API call to REDCap through R. The error only occurs on the server while it works fine on my laptop. I have downloaded the certificate in the same directory where my code is.
Error in curl::curl_fetch_memory(url, handle = handle) :
SSL certificate problem: unable to get local issuer certificate
Calls: redcap_report ... request_fetch -> request_fetch.write_memory -> <Anonymous>
Execution halted
Here is my code
library(REDCapR)
my_uri <-'https://redcap-qi.xxx.xxx.xxx/xxx/xxx/API/'
my_token <- 'xxxxxxxxxxxxxxxxx'
my_data <-
redcap_report(redcap_uri = my_uri,
token = my_token,
report_id = 12345)$data
Adding the following resolved my issue
new_config <- httr::config(ssl_verifypeer = FALSE)
httr::set_config(new_config, override = FALSE)

Related

R - BigQuery :Error in curl::curl_fetch_memory(url, handle = handle) : Failed to connect to www.googleapis.com port 443: Bad access

I'm triying to upload into Google Big Query using bigrquery package in R. At the moment I can upload into BigQuery Table successfully running the script in RStudio (without any problem), but the problem is when I calling this script from Excel, the script is stop and then close.
Please see the script below:
library(googleAuthR)
library(bigrquery)
# Set ID and dataset
project_id <- 'FR'
dataset_name <- 'table_1'
# Upload data into BigQuery
codifications_upload = bq_table(project = project_id, dataset = dataset_name, table = 'Entry_data')
bq_table_upload(x = codifications_upload, values = AHS21,create_disposition='CREATE_NEVER', write_disposition='WRITE_APPEND')
#AHS21 is a dataframe that i try to upload
The error that appers is the following:
Error in curl::curl:fetch_memory(url,handle=handle):
Failed to connect to www.googleapis.com port 443: Bad access
Calls_ bq_table_upload ... request_fetch -> request_fetch.write_memory -> <Anonymous>

Establishing a RSelenium Server

I am trying to open a remote driver using the RSelenium package with Chrome driver and encountering the following error:
>> library("XML")
>> library('RSelenium')
>> checkForServer()
Warning message:
In order(as.numeric(gsub("(.*)/.*", "\\1", selJAR)), decreasing = TRUE) :
NAs introduced by coercion
>> startServer()
Warning message:
running command 'java -jar "C:/Users/Jessica/Documents/R/win-library/3.4/RSelenium/bin/selenium-server-standalone.jar"'
had status 127
>> remDr=remoteDriver$new()
>> remDr$open() # open web browser
[1] "Connecting to remote server"
Error in function (type, msg, asError = TRUE) :
Failed to connect to localhost port 4444: Connection refused
But it seems that I am having a difficult time establishing a connection.
I think the error message after the startServer() is implying that R is unable to establish a serenium server.
One way I tried to resolve the issue is by copying both the selenium-server-standalone.jar and chromedriver.exe files into the document folder so R can find them. But so far no luck in establishing a server. What am I missing? I appreciate your help.

Rstudio to Presto connectivity

I am trying to connect Rstudio to Presto connectivity and am
receiving the error below. Please help me with support on this issue.
Error in curl::curl_fetch_memory(url, handle = handle) :
Empty reply from server
I am using the below steps, submitting the code to an Rstudio application:
library(RPresto)
library(dbConnect)
conn <- dbConnect(Presto(), catalog = 'ares', schema = 'default',
user = 'onur', host = 'localhost', port = 443,
session.timezone='US/Eastern')
dbListTables(conn, '%_iris')
dbDisconnect(conn)

Error in connecting R to Redshift

I'm trying to connect RStudio to Amazon Redshift via JDBC and this is what I tried to run:
driver <- JDBC("com.amazon.redshift.jdbc42.Driver", "~/Downloads/RedshiftJDBC42-1.2.1.1001.jar", identifier.quote="`")
# url <- "<JDBCURL>:<PORT>/<DBNAME>?user=<USER>&password=<PW>
url <- "jdbc:redshift://<cluster-name>.<xxxxxx>.us-east-1.redshift.amazonaws.com:5439/<dbname>?user=<username>&password=<password>"
conn <- dbConnect(driver, url)
When executing dbConnect(), I get the following error:
Error in .jcall(drv#jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], :
java.sql.SQLException: [Amazon](500150) Error setting/closing connection: Operation timed out.
Any idea what is causing this and how to fix it?
Update: There was a problem with access through security groups. If you're having a similar issue, check the inbound rules of your security group and make sure they allow access to Redshift via your IP.

How to set the proxy port and URL in R for the blsAPI

My employer's firewall requires I set the proxy port and url when downloading data in R using the Quandl package. I'm now trying to use the blsAPI package and the work around I used for Quandl is not working. How do I set the proxy port and URL for the blsAPI package?
Below see the code I use for Quandl:
proxyURL <- "##.#.##.###"
proxyPort <- ####,
set_config(use_proxy(url = proxyURL, proxyPort))
Below see the error I get using the blsAPI:
> response <- blsAPI('LAUCN040010000000005')
Error in function (type, msg, asError = TRUE) :
Failed to connect to api.bls.gov port 80: Timed out
Found a solution, see code below:
proxyURL <- "##.#.##.###"
proxyPort <- ####
Sys.setenv(http_proxy = paste(proxyURL, proxyPort, sep = ":"))
I can now use the blsAPI.

Resources