带有 R 的 sftp - sftp 不是带有 RCurl 的协议 [英] sftp with R - sftp not a protocol with RCurl
问题描述
我已经阅读了一些关于使用 R 的 sftp 的帖子,但无法解决我遇到的问题.有一个不错的变化,我只是没有在正确的地方搜索,如果是这样,请指出正确的方向.这是我所在的位置:
I've read a few posts on sftp with R, but was not able to address the problem that I have. There's a decent change I'm just not searching in the right place, and if that's the case, please point me in the right direction. Here's where I'm at:
> library(RCurl)
> curlVersion()
$age
[1] 3
$version
[1] "7.43.0"
$vesion_num
[1] 469760
$host
[1] "x86_64-apple-darwin15.0"
$features
ipv6 ssl libz ntlm asynchdns spnego largefile ntlm_wb
1 4 8 16 128 256 512 32768
$ssl_version
[1] "SecureTransport"
$ssl_version_num
[1] 0
$libz_version
[1] "1.2.5"
$protocols
[1] "dict" "file" "ftp" "ftps" "gopher" "http" "https" "imap" "imaps" "ldap" "ldaps" "pop3" "pop3s" "rtsp" "smb" "smbs" "smtp" "smtps" "telnet" "tftp"
$ares
[1] ""
$ares_num
[1] 0
$libidn
[1] ""
马上,我注意到 sftp 不是我当前版本的 RCurl 接受的协议,这是我的主要问题.结果,当我运行下面的代码时,出现以下错误:
Right away, I notice that sftp is not a protocol accepted in my current version of RCurl, which is my main problem. As a result, when I run the following code below, I get the following error:
# Input
protocol <- "sftp"
server <- "00.000.00.00"
userpwd <- "userid:userpass"
tsfrFilename <- 'myfile.txt'
ouptFilename <- 'myfile.txt'
# Run
url <- paste0(protocol, "://", server, tsfrFilename)
data <- getURL(url = url, userpwd = userpwd)
Error in function (type, msg, asError = TRUE) :
Protocol "sftp" not supported or disabled in libcurl
其实我还有第二个问题.我的理解是 getURL 从另一台服务器获取数据并将其拉到我的本地机器上,而我想将一个文件从我的本地机器上放到服务器上.
I actually have a second question as well. My understanding is that getURL grabs data from the other server and pulls it to my local machine, whereas I would like to put a file onto the server from my local machine.
总结:(1) 我可以更新 R 中的 RCurl/libcurl 以支持 sftp,以及 (2) 我如何将文件从本地机器放入服务器,而不是从服务器获取文件到我的本地机器?
To summarize: (1) can I update RCurl / libcurl in R to support sftp, and (2) how do i put files from my local machine into the server, rather than get files from the server to my local machine?
谢谢!
推荐答案
我找到了答案,大部分...
I found the answer, for the most part...
http://andrewberls.com/blog/post/adding-sftp-support-to-curl - 按照这个链接解决了我的问题.
http://andrewberls.com/blog/post/adding-sftp-support-to-curl - following this link addressed the problem for me.
我已经成功地为 cURL 添加了 sftp 支持,但是我现在正在努力更新 RCurl 包以具有相同的...
I've successfully added sftp support to cURL, however I am now struggling to update the RCurl package to have the same...
这篇关于带有 R 的 sftp - sftp 不是带有 RCurl 的协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!