我正在尝试下载一个 1.1 GB 的文件,httr
但我遇到了以下错误:
x <- GET( extract.path )
Error in curlPerform(curl = handle$handle, .opts = curl_opts$values) :
cannot allocate more space: 1728053248 bytes
我的 C 盘有 400GB 可用空间。
在RCurl
包中,我在使用时看到maxfilesize
andmaxfilesize.large
选项,getCurlOptionsConstants()
但我不明白这些是否/如何传递给httr
throughconfig
或set_config
.. 或者我是否需要切换到RCurl
这个.. 即使我确实需要切换,增加最大文件大小会起作用吗?
这是我的会话信息..
> sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] XML_3.96-1.1 httr_0.2
loaded via a namespace (and not attached):
[1] digest_0.6.0 RCurl_1.95-4.1 stringr_0.6.2 tools_3.0.0
..and(不建议这样做,因为它会花费你一段时间)如果你想重现我的错误,你可以去https://usa.ipums.org/usa-action/samples,注册一个新的帐户,选择 2011 5 年 acs 提取,添加大约一百个变量,然后等待提取准备好。然后编辑前三行并运行下面的代码。(再次,不推荐)
your.email <- "email@address.com"
your.password <- "password"
extract.path <- "https://usa.ipums.org/usa-action/downloads/extract_files/some_file.csv.gz"
require(httr)
values <-
list(
"login[email]" = your.email ,
"login[password]" = your.password ,
"login[is_for_login]" = 1
)
POST( "https://usa.ipums.org/usa-action/users/validate_login" , body = values )
GET( "https://usa.ipums.org/usa-action/extract_requests/download" , query = values )
# this line breaks
x <- GET( extract.path )