Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
getURL和downfile.file已赢得';下载网页内容(R)_R_Geturl - Fatal编程技术网

getURL和downfile.file已赢得';下载网页内容(R)

getURL和downfile.file已赢得';下载网页内容(R),r,geturl,R,Geturl,目前我正在研究R中的“getURL”和“download.file”命令。到目前为止,这两个命令都非常有效 然而,我有一个特定的链接问题,我不知道为什么这一个不工作 运行 getURL ("http://www.r-bloggers.com/improving-script_002-%e2%80%9cmonitor%e2%80%9d/") 产生错误: curlPerform中出错(curl=curl,.opts=opts,.encoding=.encoding): 字符串“\037\b”中嵌入

目前我正在研究R中的“getURL”和“download.file”命令。到目前为止,这两个命令都非常有效

然而,我有一个特定的链接问题,我不知道为什么这一个不工作

运行

getURL
("http://www.r-bloggers.com/improving-script_002-%e2%80%9cmonitor%e2%80%9d/")
产生错误:

curlPerform中出错(curl=curl,.opts=opts,.encoding=.encoding): 字符串“\037\b”中嵌入的nul

“download.file”命令还创建了一个奇怪的编码文件:

download.file
("http://www.r-bloggers.com/improving-script_002-%e2%80%9cmonitor%e2%80%9d/",
"test.html")

这对您有用吗?

问题在于URL中的引号。你需要先对它进行编码。这将正常工作

getURL(URLencode("http://www.r-bloggers.com/improving-script_002-%E2%80%9Cmonitor%E2%80%9D/"))