Move remote file in SFTP using R and RCurl - r

I need to rename a remote file once I download them. I tried to use the following command, but its not working.
input = getURL(url, userpwd="user:password", postquote=c("/inputs/", "RNFR abc.xml", "RNTO abc.xml_processed"))
This is throwing the error message
Error in function (type, msg, asError = TRUE) : Unknown SFTP command
Please somebody suggest me some insight into this.
Update
I tried with the complete paths like,
input = getURL("url/abc.xml", userpwd="user:password", postquote=c("RNFR /inputs//abc.xml", "RNTO /inputs/abc.xml_processed"))
Still same error Error in function (type, msg, asError = TRUE) : Unknown SFTP command.

Related

Using RCurl, how to download the "clone from github" zip file?

If I want to download a clone as a zip, it does a redirect.
zip.url = "https://github.com/MonteShaffer/humanVerse/archive/refs/heads/main.zip"
redirects to:
<html><body>You are being redirected.</body></html>
I am trying to using the RCurl library:
require(RCurl)
curl.fun = basicTextGatherer();
curl.ch = getCurlHandle();
x = getBinaryURL(zip.url, curl = curl.ch, headerfunction = curl.fun$update )
One windoze 10, throwing this error:
Error in function (type, msg, asError = TRUE) :
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
I am assuming github is doing multiple redirects. I want to download the file as a binary 'zip'.
You have to set the curl option followlocation to TRUE, like this:
binary_blob <- RCurl::getBinaryURL(zip.url, .opts = list(followlocation = TRUE))
It might be easier to download the file instead with the following two options:
utils::download.file() comes with R and works for this.
zip.url <- "https://github.com/MonteShaffer/humanVerse/archive/refs/heads/main.zip"
download.file(zip.url, "main.zip")
The curl package has curl_download().
library(curl)
curl::curl_download(zip.url, "main2.zip")

H2o with predict_json: "Error: Could not find or load main class water.util.H2OPredictor"?

I tried to use the H2o predict_json in R,
h2o.predict_json(modelpath, jsondata)
and got the error message:
Error: Could not find or load main class water.util.H2OPredictor
I am using h2o_3.20.0.8.
I searched the documentation from H2o but didn't help.
> h2o.predict_json(modelpath, jsondata)
$error
[1] "Error: Could not find or load main class water.util.H2OPredictor"
Warning message:
In system2(java, args, stdout = TRUE, stderr = TRUE) :
running command ''java' -Xmx4g -cp .:/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mylib/Models/h2o-genmodel.jar:/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mylib/Models:genmodel.jar:/ water.util.H2OPredictor /Library/Frameworks/R.framework/Versions/3.5/Resources/library/mylib/Models/mymodel.zip '[{"da1":252,"da2":22,"da3":62,"da4":63,"da5":84.83}]' 2>&1' had status 1
It looks like you are missing your h2o-genmodel.jar file - this is what the error message Could not find or load main class water.util.H2OPredictor indicates. You may want to provide all the arguments to checkoff that you have everything:
h2o.predict_json(model, json, genmodelpath, labels, classpath, javaoptions)
documentation here

Error in function (type, msg, asError = TRUE) : Could not resolve host: datamarket.accesscontrol.windows.net

I am trying to convert a text from French to English using translate
function in translateR package. I am using MS translator. Could
anybody help me to solve this? I am new to R language and don't have
much expertise into this.
This code:
library(translateR)
res <- translate(content.vec = c("Hello world.", "This is a test."),
microsoft.client.id = "143bc77b-80fd-4a71-ae9d-7e37373fd84c",
microsoft.client.secret = "biAW515)[jpbulULGTK11$+",
source.lang = "en",
target.lang = "de")
res
Throws error:
Error in function (type, msg, asError = TRUE) :
Could not resolve host: datamarket.accesscontrol.windows.net
In addition: Warning message:
The content appears to be in MIDDLE_FRISIAN. However, the language code you provided suggests that
the text is in ENGLISH. If you entered the wrong language code, stop the process. Otherwise,
translateR will treat the text as ENGLISH.

Error in getGEO command in GEOquery

I`m running the following commands to get the data from GEO
library(GEOquery)
gset <- getGEO("GSE9476", GSEMatrix =TRUE, AnnotGPL=TRUE)
But, faced the following error
https://ftp.ncbi.nlm.nih.gov/geo/series/GSE9nnn/GSE9476/matrix/
Error in function (type, msg, asError = TRUE) :
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

Error in translateR package

I am trying to convert a text from French to English using translate function in translateR package. I am using MS translator. Could anybody help me to solve this? I am new to R language and don't have much expertise into this.
This code:
text1 <- "joyeux Noël"
translate(content.vec=text1, microsoft.client.id='xxxxxx',
microsoft.client.sec‌ret = 'ZlZ39GooG6w1oiDlUgPcUQXGq7B+jCfchdrL9h0ebz8=',
source.lang = 'fr', target.lang = '‌​en')
Throws:
Error in fromJSON(postForm("https://datamarket.accesscontrol.windows.net/v2/OAuth2-13", :
error in evaluating the argument 'content' in selecting a method for function 'fromJSON': Error in function (type, msg, asError = TRUE) :
Failed to connect to datamarket.accesscontrol.windows.net port 443: Connection refused

Resources